错误-linux centOS7-MySQL登录时出现Access denied for user 'root'@'localhost' (using password: YES) 拒绝访问

1.错误提示

2.修改MySql配置文件my.cnf,新增skip-grant-tables

 

 添加skip-grant-tables,这样mysql可以免密登录。

 

3.重启服务
重启mysqld服务

4.再次连接MySql,重置密码
任意密码就可以进入了

 

 切换到mysql数据库

 

 

 重置密码(为 root )

update user set authentication_string=password('root') where user='root';

5. 修改配置文件my.cnf,删除skip-grant-tables,重启,再登录

删除skip-grant-tables

重启服务

再次使用新密码登录即可

posted @ 2021-03-15 22:40  BlueValentines  阅读(1104)  评论(0)    收藏  举报