Pages

Friday, November 26, 2010

Reinitializing the root password of MySQL

It's important that you are able to access and modify the admin (root) password of MYSQL, either when installing MySQL for the first time or in situations where the master password is lost. 

The root password is lost!

To be able to modify the existing root password, you must firstly be connected to it. If you know the root password and just want to reinitialize it, you can skip this part. In the case that you donĂ¢€(TM)t have the root password then follow the steps below. 
It s is possible to bypass the authentication process and to access MySQL:

  • Stop the MySQL server.
    • #/etc/init.d/mysql stop
  • Restart MySQL, disabling network communication and skipping the authentication procedure.
    • #mysqld --skip-grant-tables --skip-networking &

Reinitializing the password:

  • Get connected to the system database (mysql) of MySQL:
    • # mysql mysql -u root
  • Type in the following command and reset your password
    • UPDATE user SET password=PASSWORD('newpassword') WHERE user="root";
  • If you didn't go through the first step, to validate the changes simply type:
    • FLUSH PRIVILEGES;
  • If you started MySQL manually(bypassing the authentication process), the server must be restarted:
    • #/etc/init.d/mysql restart

source: http://en.kioskea.net/faq/630-reinitializing-the-root-password-of-mysql

No comments:

Post a Comment