Resettting your mySQL root password
When you need to reset your root password for your mySQL server, proceed this way:
# sudo /etc/init.d/mysql stop
# sudo mysqld_safe --skip-grant-tables &
# sudo mysql -u root
on the mySQL console:
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
# sudo /etc/init.d/mysql stop
# sudo /etc/init.d/mysql start
To confirm you indeed have access to mySQL with the new password:
# mysql -u root -p
Comments