Install MySQL on Mac using Brew

First you need Homebrew installed. Please check my other post about installing Homebrew on Mac.

Installing MySQL

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:

mysql.server start

To stop MySQL;

mysql.server stop

To connect to MySQL:

mysql -uroot

By default, root has no password.

Configure MySQL

To set the root password:

mysqladmin -u root password 'yourpassword'

To have launchd start mysql now and restart at login:

brew services start mysql

Leave a Comment

Your email address will not be published. Required fields are marked *