Upgrading MySQL server in MacOS
Installer
(Latest) https://dev.mysql.com/downloads/mysql/
(v5.7) https://dev.mysql.com/downloads/mysql/5.7.html#downloads
Change Temporary Password
(1) Open Terminal
(2) Connect to MySQL server with the temporary password
$ mysql -u root -p
(3) Change password with Alter User command
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'my-password';
(4) Perform a flush privilege and it should complete with no errors.
mysql> FLUSH PRIVILEGES;
Recover data from Older version
(1) Stop MySQL server.
(2) Go to:
$ cd /usr/local
You should see several MySQL directories. E.g.
$ ls | grep mysql- mysql-5.7.20-macos10.12-x86_64 mysql-5.7.23-macos10.13-x86_64 mysql-5.7.27-macos10.14-x86_64
(3) Rename the data directory in the currently running version.
$ sudo mv ./mysql-5.7.27-macos10.14-x86_64/data ./mysql-5.7.27-macos10.14-x86_64/olddata
(4) Copy the data directory from a previous version that you want to recover.
$ sudo cp -rf ./mysql-5.7.23-macos10.13-x86_64/data ./mysql-5.7.27-macos10.14-x86_64/data
(5) Set ownership of the new data directory
$ sudo chown -R _mysql:_mysql ./mysql-5.7.27-macos10.14-x86_64/data
(6) Start MySQL Server
AI Summary
Chrome On-device AI
2024-09-19 18:36:05
Share Article