Would you like to learn how to recover the MySQL admin password? In this tutorial, we are going to show you how to use the MySQL password recovery procedure to change the password of the root user using the command-line of a computer running Ubuntu Linux.

• Ubuntu 18.04
• Ubuntu 19.04
• MySQL 8.0.18

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial MySQL - Password Recovery

Stop the MySQL service.

Copy to Clipboard

Create the required directory and set the proper permission.

Copy to Clipboard

Restart the MySQL service using the following command.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Access the MySQL command-line.

Copy to Clipboard

Set a new password to the MySQL root user.

Copy to Clipboard

In our example, we set the password kamisama123 to the MySQL root user

Stop the MySQL service using toe following command.

Copy to Clipboard

You will need to enter the new MySQL root password to stop the service.

Start the MySQL service.

Copy to Clipboard

Try to access the MySQL service using the new root password.

Copy to Clipboard

Congratulations! You successfully recovered the password of the MySQL root user.