Reset The Root Password Of MySQL Server

by lifeLinux on November 24, 2010

By default, MySQL server will be installed with root account and password is blank. If you have set the password for root and forget it, then you will need to reset the root password for MySQL.

This topic has detail steps on how to reset password for root on MySQL Server.

Step 1: Stop MySQL service

service mysqld stop

Step 2: Start MySQL with mysql-safe command

mysql-safe --skip-grant-tables &

–skip-grant-tables is a option to enable anyone connect MySQL Server without password and with all privileges.

Step 3: Connect MySQL with root account and blank password

mysql -u root -p

Step 4: Change password for root account

mysql>   UPDATE mysql.user SET password = PASSWORD('NEW_PASSWORD') WHERE User = 'root';
mysql>   exit;

Step 5: Restart MySQL

service mysqld restart

Related Posts:

{ 1 comment… read it below or add one }

magicii May 15, 2011 at 3:45 pm

it’s useful for me ! sometime it’s good for some other with absent-mind 😀


Previous post:

Next post: