Installing MySQL for macOS

1. Open a new Terminal window

2. Enter the following command into the Terminal window and hit return.

brew install mysql

3. Enter the following command into the Terminal window and hit return.

brew services start mysql

4. Enter the following command into the Terminal window and hit return.

mysql -u root

5. Enter the following command into the Terminal window and hit return.

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'root';

6. Close the Terminal window.

WARNING

The following steps are only for those who had trouble completing steps 4 or 5.

1. Open a new Terminal window

2. Enter the following command into the Terminal window and hit return.

brew services stop mysql

3. Enter the following command into the Terminal window and hit return.

mysqld_safe --skip-grant-tables &

NOTE

Wait for the process to finish with the message "Starting mysqld daemon with databases..." before continuing.

4. Enter the following command into the Terminal window and hit return.

mysql

You should receive the mysql> prompt.

5. Enter the following command into the Terminal window and hit return.

FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'root';

6. Close the Terminal window.