Getting Started with MySQL on OS X
Install MySQL
Download MySQL Community Server, and install it.
Take note of the username and password it generates for you.
Add it to the PATH
Add the MySQL bin folder to your PATH
and restart your terminal:
# ~/.zshrc
export PATH="$PATH:/usr/local/mysql/bin/"
Change the password, then forget it.
$ mysql
mysql> SET PASSWORD = PASSWORD('your_new_password');
Query OK, 0 rows affected, 1 warning (0.00 sec)
Create a .my.cnf
file in your home folder so you don’t have to authenticate
when you are in your local dev environment.
# ~/.my.cnf
[client]
user=root
password=password-from-eariler
Make this file only readable by you.
$ chmod 0600 ~/.my.cnf
Start it up
Start up MySQL Server from the System Preferences menu.
Now, you should be able to get to the MySQL console by typing mysql
!