What to do if you forget your MySQL admin password

1) run mysql daemon with these options:


sudo /usr/sbin/mysqld --skip-grant-tables --user=root


2) run mysql client and enter the following commands:

mysql> USE mysql
mysql> UPDATE user SET password=password("mysqlpass*0987") WHERE user="root";
mysql> flush privileges;
mysql> exit


3) restart mysql

A more complete explanation is found here

No comments: