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.

Good luck 🙂

Default image
Musa Amin
I am a Linux System Administrator and also write many tutorials about Linux, Cloud, and Open Source. Hire me via email hai[at]musaamin.web.id.

Leave a Reply