Reset Mysql Root Password

    •  Login to root prompt
    • Stop the mysql Server
# /etc/init.d/mysql stop
  •   start the Mysql server in safe mode
# /usr/local/mysql/bin/safe_mysqld –user=mysql –skip-grant-tables –skip-networking &
    •  Reset password
# /usr/local/mysql/bin/mysqladmin -u root flush-privileges password “newpassword”

sometime the above command would not work and password need to be reset with below given process

Login to mysql server, type the following command at shell prompt:

$ mysql -u root -p

Use mysql database (type command at mysql> prompt):

mysql> use mysql;

Change password for user root, enter:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='root';

Finally, reload the privileges:

mysql> flush privileges;
mysql> quit
  • Restart the Mysql Server
# /etc/init.d/mysql restart
This entry was posted in MySQL. Bookmark the permalink.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.