Reset MySQL password
Thursday, August 26th, 2004Here’s how to reset the forgotten root password for mysql,
$ sudo su
$ /etc/init.d/mysql stop
$ mysqld –skip-grant-tables
$ mysql -u root mysql
mysql>UPDATE user SET Password=PASSWORD(’newpwd’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;
mysql>quit
$ /etc/init.d/mysql start