Sunday 15 May 2011

Reset MySQL Root Password


Here’s a quick way to reset your mysql root password. Replace ‘NewRootPass’ with your new root password and run the following as root.

/etc/init.d/mysql stop
mysqld --skip-grant-tables --user mysql &
mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('NewRootPass') WHERE User='root'"
/etc/init.d/mysql restart
Note: This was done on CentOS. You might need to adjust the path to mysql’s startup scripts accordingly.

No comments:

Post a Comment