windows下MySql密码重置
Windows下操作 www.2cto.com
1.关闭正在运行的MySQL。
2.打开DOS窗口,转到mysql\bin目录。
3.输入mysqld --skip-grant-tables回车。
如果没有出现提示信息,那就对了。
4.再开一个DOS窗口,转到mysql\bin目录。
5.输入mysql回车,如果成功,将出现MySQL提示符 >
6.改密码:> update user set password=password("520") where user="root";
7.刷新权限>flush privileges;
8.退出 > \q
9.注销
系统,再进入。
flush privileges
GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED by 'root' WITH GRANT OPTION
今天接手一台mysql,root@localhost账户进入,发现授权时报错如下:
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'yao'
最终发现该root在初始授权时没有加上with grant option
解决办法:
配置文件中增加skip-grant-tables
重启mysql后重新登录授权报错:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
这个错误执行flush privileges后再次授权就可以了。