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/

  1.  Stop MySQL sudo /etc/init.d/mysql stop
  2. 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 &
  3. Start MySQL  sudo /etc/init.d/mysql start
  4. Login to MySQL mysql
  5. Update the root password use mysql; show tables; SELECT User FROM users; UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';  exit;
  6. Stop MySQL, undo the changes to the startup script and restart. Check that the new password works. mysql -u root -p