Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Ibrar Hussain
Ibrar Hussain

Posted on

     

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.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
Enter fullscreen modeExit fullscreen mode

this should show themysql with5.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
Enter fullscreen modeExit fullscreen mode

The above command shouldOK for all without any errors.

Step # 3

Check for MySQL processes via the following command:

ps-ax |grepmysql
Enter fullscreen modeExit fullscreen mode

list of processes with PID

Stop and kill any MySQL processes via the following command:

kill{PID}
Enter fullscreen modeExit fullscreen mode

Step # 4

Take a backup ofmy.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 mysqlbrew cleanup
Enter fullscreen modeExit fullscreen mode

You can confirm the uninstall by runningbrew services list and there should not bemysql listed

brew services list not including mysql

Step # 6

Install latest version 8.0 of the MySQL:

brewinstallmysqlbrew services start mysql
Enter fullscreen modeExit fullscreen mode

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
Enter fullscreen modeExit fullscreen mode

It should prompt you steps like the following screenshot:

set mysql password

Step # 8

Connect tomysql viaSequel Ace

sequel ace connection settings for mysql

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

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
lamri_abdellahramdane_15 profile image
Lamri Abdellah Ramdane
Developer passionate about clean code, open source, and exploring new tech.
  • Joined

Upgrading MySQL from 5.7 to 8.0 on Mac can be tricky, so this guide is invaluable! Migrations always come with their own set of challenges. I've found ServBay dramatically simplifies managing database versions and upgrades in my local dev environment, making these transitions much smoother. Super helpful!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I am a full stack web developer with experience working on Laravel and Vue. I am passionate about exploring and learning new technologies in the field.
  • Location
    Melbourne
  • Work
    Full Stack Web Developer
  • Joined

More fromIbrar Hussain

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp