In this post, I will be walking you through how I installed MySQL on my MacBook Pro.
I, recently, purchased a MacBook Pro and this serves as the go to toy for all my programming stuffs that I do at home. Mac OS is fairly new to me and I wanted to install MySQL on it, to play with WordPress installations locally.
I will be using Homebrew to install MySQL on Mac OS. Homebrew is the package manager for Mac OS and I highly recommend it. If you are new to Homebrew, then I recommend that you read this post from Tutsplus before you continue reading further.
Now that you know what Homebrew is, let me show you, how I installed MySQL on Mac OS.
If you haven’t installed Homebrew already, on your Mac OS, you can follow the install instructions on Homebrew website to get Homebrew installed. Let’s brew it!
Step 01: Fire up the Terminal and execute
brew doctor. This command checks for potential problems with Homebrew. You can ignore the warnings that you get when you run this command, but not errors.
Step 02: Now, run
brew update to update Homebrew and all new formulae.
Formulae are instructions for Homebrew on how to install specific software and where to find the necessary files and dependencies.
Step 03: Now we can install MySQL by running the command
brew install mysql. Now you can sit back and relax while Homebrew installs MySQL and it’s the dependencies.
Once installed, you can connect to MySQL using the command
mysql -u root.
You can continue using local MySQL without a passowrd. But, I prefer to secure my local installation and in order to that, we can run the
mysql_secure_installation command. Setting the password, from here on, is self explanatory.
Below are all the terminal commands needed for the complete installation of MySQL.