How To Reset Root Password MySQL Server

Reset Root Password MySQL Server

In this tutorial, we will show you how to reset the root password MySQL server. By default, MySQL server will be installed with root account and password is blank. Have you ever forgotten the root password on one of your MySQL servers? If you have set the password for root and forget it, then you will need to reset the root password for MySQL. To reset your MySQL password just follow these instructions and we assume that you already have a small amount of knowledge on MySQL.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The reset password MySQL is quite simple. I will show you through the step-by-step reset root password MySQL server.

Reset Root Password MySQL Server

Step 1. First thing to do is stop MySQL.

### CentOS 6 ###
sudo service mysqld stop

### CentOS 7 ###
sudo systemctl stop mysqld

Step 2. Next we need to start MySQL in safe mode with the --skip-grant-tables option so that it will not prompt for password.

mysqld_safe --skip-grant-tables &

Step 3. Start the MySQL client process using this command with a root account and a blank password.

mysql -u root

 Step 4. Change the password for the root account.

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where #User='root';
mysql> flush privileges;
mysql> quit

 Step 5. Restart MySQL.

Once complete, you can restart MySQL is installed by running the below command:

### CentOS 6 ###
service mysqld restart

### CentOS 7 ###
systemctl restart mysqld

Congratulations! You have successfully reset password MySQL. Thanks for using this tutorial for reset root password MySQL on the Linux system. For additional help or useful information, we recommend you check the official MySQL website.

MySQL Fix Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “MySQL Fix”, starting from $10 (Paypal payment). Please contact us to get a best deal!

Save