Install MySQL 8 in MacOS
Assalamualaikum / Hi,
This time I will show you how to install latest MySQL 8 in your MacOS.
Backup & Clean Up
Backup your database first, then run the following command to uninstall MySQL.
$ brew uninstall mysql --force
Clean up data directory — since you already have backup previously.
$ rm -fr /usr/local/var/mysql/
Then you also need to remove / backup your my.cnf
, since there’s few thing that the configuration is not used anymore, I received the following error.
If you not sure where your my.cnf
, use the following command:
$ mysql --verbose --help | grep my.cnf
Installation
Then install new MySQL 8 via Homebrew:
$ brew install mysql
Once you are done, start the MySQL service:
$ brew services start mysql
Now you should be able to have MySQL 8 started:
$ brew services list
Authentication
There’s an issue to authenticate, where I did received the following error:
caching_sha2_password' cannot be loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so, 2): image not found
So what I did, I change the default_authentication_plugin
using mysql_native_password
.
Open up my.cnf
— mine located at /usr/local/etc/my.cnf
Add the following at the end of the file:
default_authentication_plugin=mysql_native_password
Save and exit.
Next, you need to login via terminal:
$ mysql -uroot
Then run the following command to update the root
password:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
Now you should be able to login to your MySQL 8 via your MySQL Client.
Sequel Pro
If you are using Sequel Pro as your MySQL Client, you may want to use the test builds — because the stable version keep on crashing, all the time.
Go to https://sequelpro.com/test-builds and download latest Completed build version. You should have something like the following after the installation: