Mysql 1045解决

390 阅读1分钟

windows

1、用everything找到my.ini文件

2、找到文件后Ctrl+f找到这行:[mysqld]

3、在找到行的下一行添加行:skip_grant_tables

4、在服务管理重启Mysql服务

5、运行cmd,执行mysql -u root -p

就可以不用密码登录了,出现password:的时候直接回车可以进入

6、进入Mysql数据库,敲入命令:use mysql;

7、输入命令

 update user set password=password("123456") where user="root";

如果是因为字段名password不对提示错误,那么执行如下命令:

update user set authentication_string=password("P@ssw0rd") where user="root";

8、输入命令

flush privileges;

9、在服务管理重启Mysql服务