您的位置:首页 > 数据库 > MySQL

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

2016-11-07 13:24 651 查看
最近在centos7下安装mysql5.7后,登录报以下错误:

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

解决方法:

1.修改/etc/my.cnf文件,在最后一行加上

skip-grant-tables


2.重启mysql

service mysqld restart


3.免密码登录mysql,输入一下命令,直接回车,不需要密码:

mysql -uroot -p


4.修改root密码:

user mysql;
update user set authentication_string=password("123456") where user="root";
flush privileges;


5.退出,并删除/etc/my.cnf文件中的skip-grant-tables

6.重启mysql,并用新密码登录

service mysqld restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql error-1045
相关文章推荐