How to Change and Reset MySQL 8 Root Password on Ubuntu 18.04

How to Change and Reset MySQL 8 Root Password on Ubuntu 18.04

MySQL database has a root user who is the main user or administrator who can configure and have access to all databases. Very often there are cases of wanting to change the root password for example because it changed the system administrator. In the case of a password reset, it’s usually because you forgot the root password. Well, in this tutorial I will discuss about how to change and reset the MySQL 8 password on Ubuntu 18.04.

Change Password

Change the root password here means that we can still log in using the root user, we still know the password, but want to change the password.

Login to MySQL with the root user.

Change the root password.

Login back to MySQL to test the new password.

Password Reset

Reset password here means we forget or don’t know the root password, so you have to reset or forced change the password.

Stop mysql service.

Run the mysql service with the –skip-grant-tables option.

Login to MySQL.

Reload grant table.

Change the root password.

Reload grant table and exit.

Restart Ubuntu.

Login to MySQL using a new password.

If you found this article helpful and would like to support my work, consider making a donation through PayPal. Your support helps me continue creating useful content and tutorials. Thank you!

Donate via PayPal: https://paypal.me/musaamin

Leave a Reply

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