
问: 如果忘记了MySQL的root密码应当如何取回?
答: 解决方法如下:
在my.cnf的[mysqld]字段加入:
skip-grant-tables
然后重启你的mysqld,这样久没有密码了.
然后进入mysql。
UPDATE mysql.user SET Password=PASSWORD
('password') WHERE User='root';
成功后
FLUSH PRIVILEGES;
最后去掉my.cnf中的skip-grant-tables
重启mysqld。(