Forgot root MySQL password;
Tech Notes
You can easily reset your root SQL password using the following method. These instructions are for Debian. http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/
- Stop MySQL
sudo /etc/init.d/mysql stop - Edit the MySQL start up script. Look for the line that starts the daemon.
sudo vi /etc/init.d/mysql # /usr/bin/mysqld_safe > /dev/null 2>&1 & /usr/bin/mysqld_safe --skip-grant-tables > /dev/null 2>&1 & - Start MySQL
sudo /etc/init.d/mysql start - Login to MySQL
mysql - Update the root password
use mysql; show tables; SELECT User FROM users; UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root'; exit; - Stop MySQL, undo the changes to the startup script and restart. Check that the new password works.
mysql -u root -p