How to Upgrade MySQL 5.7 to 8.0 on Mac

As new versions of MySQL are coming out, at one point you will need to upgrade your MySQL version as well.

In this article, we will assume that we are using MySQL 5.7 for your local development on Mac and want to upgrade it the latest version (MySQL 8…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Ibrar Hussain

As new versions of MySQL are coming out, at one point you will need to upgrade your MySQL version as well.

In this article, we will assume that we are using MySQL 5.7 for your local development on Mac and want to upgrade it the latest version (MySQL 8.0).

Followings are the steps to follow:

Step # 1

Make sure to do database dump for all of your databases, as you will need these to re-import it again when MySQL is successfully upgraded.

Step # 2

Confirm that your running MySQL 5.7 via the following command:

brew services list

this should show the mysql with 5.7 version running.

brew services list with mysql

Before you start upgrading process, make sure to double-check that your existing MySQL 5.7 setup ticks all the boxes on the sanity checklist before upgrading to MySQL 8.0.

You can do it by running the following command:

mysqlcheck -u root -p --all-databases --check-upgrade

The above command should OK for all without any errors.

Step # 3

Check for MySQL processes via the following command:

ps -ax | grep mysql

list of processes with PID

Stop and kill any MySQL processes via the following command:

kill {PID}

Step # 4

Take a backup of my.cnf located at: /usr/local/etc/my.cnf

and remove this file via command: rm /usr/local/etc/my.cnf

Step # 5

Uninstall MySQL via the following command:

brew remove mysql
brew cleanup

You can confirm the uninstall by running brew services list and there should not be mysql listed

brew services list not including mysql

Step # 6

Install latest version 8.0 of the MySQL:

brew install mysql
brew services start mysql

Once done, you can confirm the version of the MySQL by running the command: mysql --version which should show the latest version of the MySQL

mysql version

Step # 7

Setup default root password with the following command:

mysql_secure_installation

It should prompt you steps like the following screenshot:

set mysql password

Step # 8

Connect to mysql via Sequel Ace

sequel ace connection settings for mysql

and create any relevant databases and import them from your previous backup dump.


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Ibrar Hussain


Print Share Comment Cite Upload Translate Updates
APA

Ibrar Hussain | Sciencx (2023-01-10T22:54:29+00:00) How to Upgrade MySQL 5.7 to 8.0 on Mac. Retrieved from https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/

MLA
" » How to Upgrade MySQL 5.7 to 8.0 on Mac." Ibrar Hussain | Sciencx - Tuesday January 10, 2023, https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/
HARVARD
Ibrar Hussain | Sciencx Tuesday January 10, 2023 » How to Upgrade MySQL 5.7 to 8.0 on Mac., viewed ,<https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/>
VANCOUVER
Ibrar Hussain | Sciencx - » How to Upgrade MySQL 5.7 to 8.0 on Mac. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/
CHICAGO
" » How to Upgrade MySQL 5.7 to 8.0 on Mac." Ibrar Hussain | Sciencx - Accessed . https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/
IEEE
" » How to Upgrade MySQL 5.7 to 8.0 on Mac." Ibrar Hussain | Sciencx [Online]. Available: https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/. [Accessed: ]
rf:citation
» How to Upgrade MySQL 5.7 to 8.0 on Mac | Ibrar Hussain | Sciencx | https://www.scien.cx/2023/01/10/how-to-upgrade-mysql-5-7-to-8-0-on-mac/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.