First you need Homebrew installed. Please check my other post about installing Homebrew on Mac.
To install MySql, please open your Terminal and the following command:
brew install mysql
Once it is installed, MySQL is configured to only allow connections from localhost by default.
To start MySql:
To stop MySQL;
To connect to MySQL:
By default, root has no password.
To set the root password:
mysqladmin -u root password 'yourpassword'
To have launchd start mysql now and restart at login:
brew services start mysql