How to Reset Root Password in MySQL 8.0

If you forget the MySQL root password on MySQL 8.0 server, you can follow the instruction here to reset the root user password.

First, stop the MySQL server if it is already running

Create folder

Now start MySQL with –skip-grant-tables option

Take a new terminal, connect to MySQL

When it asks for the root password, just press enter. No need to enter any password. To reset MySQL root password, run

After running the above 2 SQL commands, exit MySQL command prompt with command exit or press CTRL+D.

Now you need to find the process ID of MySQL

Kill the process with

Now start MySQL normally with

Now you will be able to login to the MySQL server using the new PASSWORD

See MySQL root password, MySQL Could not create unix socket lock file

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *