Today I decided to upgrade my MySQL database from 5.6 to 5.7. Previously I was using Bitnami MAMP DB version. Today I decided use homebrew version upgrade my MySQL.
To install MySQL is pretty simple. However, if you installed previous MySQL version before. It will be a challenge for you. My advice is to delete all your old data to avoid running in
mysql_upgrade command required by MySQL when you need to run some command related to sys database.
To install MySQL with homebrew is:
You can check what are you going to install via this command.
brew info mysql it will prompt and listed what will be version will be installed. For my today case, it is 5.7.21. Then I confirmed I wanted to install.
brew install mysql
If you want to restart MySQL run
brew services restart mysql
Please take note that, once you have restarted your mysql. Homebrew will copy
/usr/local/Cellar/mysql/your version/homebrew.mxcl.mysql.plist to
So whatever you want to edit, please edit on
MySQL 5.7 does not have default my.cnf, you also cannot find in the default
support-files that ship together. You may just create one at
/etc/my.cnf, please take note that not all the setting will be applied via this file.
For example. bind-address. Sometimes it binds together with start process.
More info:- https://dba.stackexchange.com/questions/55958/cant-remote-access-mysql-server-running-on-mac-os-x
Remove old MySQL data in homebrew
ps -ef | grep mysql with this command, you actually can see the mysql process bind to what parameter.
So for my case, mysql
datadir=/usr/local/var/mysql, you may delete this one first before you install.