MySQL root Password Reset

January 3, 2016 - Guides, Linux
MySQL root Password Reset


if by some reason you forgot your Mysql “root” Password, or you need to force a Mysql root password reset on a linux system, you can use the following commands to accomplish it:


Let’s start by stopping Mysql services

/etc/init.d/mysql stop

(On redhat/centos/fedora systems the service is called mysqld)
Now i start Mysql in safe mode on the background, so it won’t check the permission’s table

mysql_safe –skip-grant-tables &

Login as root without password

mysql -u root

After logging in select the mysql table

use mysql;

Now i can change the root password with the following command

UPDATE user set password=PASSWORD(“mynewpassword”) where user=’root’;
Let’s update the permission’s table

flush privileges;

And i can quit Mysql

Now i restart Mysql

/etc/init.d/mysql stop

/etc/init.d/mysql start

Job done!
Now i can login as root with the new password

mysql -u root -p

Please follow and like me at:

One thought on “MySQL root Password Reset

sikis izle

Buen artículo! Gracias..


Leave a Reply

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