Reset MySQL root password in macOS

In this tutorial, I will show you the way to reset MySQL root password in macOS.

Note: I work with MySQL 5.7.x for this tutorial,

First of all, we need stop MySQL server using MySQL Start/Stop Configuration as below:

Reset MySQL root password in macOS

Then, open Terminal and start MySQL server in safe mode:

Reset MySQL root password in macOS

Next, open other Terminal and try to login with user root without password:

Reset MySQL root password in macOS

Update password for root user by using following command:

Update privileges:

Reset MySQL root password in macOS

Now, you can login user root with your password.

Reset MySQL root password in macOS

But right now, if you try to execute any SQL statements, you will get the messages as below:

Reset MySQL root password in macOS

To resolve this message, you must execute again the statement to update the password:

Reset MySQL root password in macOS

Now, you can execute your statement.

Reset MySQL root password in macOS

 

Add Comment