Resetting your mysql root password

Thu, Aug 13, 2009

Linux

  1. First of all we need to stop mysql
    /etc/init.d/mysql stop
  2. Create a mysql table dump to reset the password
    UPDATE mysql.user SET Password=PASSWORD('YOUR-NEW-MYSQL-PASSWORD') WHERE User='root';
    FLUSH PRIVILEGES;
  3. Now we need to start mysql in safe mode and import the mysql table dump
    mysqld_safe --init-file=/path/to/mysql/table/dump &
  4. Finally we need to kill mysql and start it in normal mode
    killall mysqld
    /etc/init.d/mysql start
  5. Your password should now be reset to the one you specified in the mysql table dump
, , , , , ,

This post was written by:

Duffy - who has written 48 posts on Tuts4Tech.

I am the owner of this website, please feel free to ask me any questions you have

Contact the author

Leave a Reply