Linux下解决mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)错误

1.首先我们修改mysql配置文件 vi /etc/my.cnf,加入如下配置

20180806093445348.png

2.service mysql stop 关闭mysql

3.service mysql start 启动mysql

4.

mysql> use mysql;
mysql> update user set password=password("你的新密码") where user="root";
mysql> flush privileges;
mysql> quit;
注:mysql >=5.7 
update user set authentication_string=password("MyNewPass4!") where user="root";

5、关闭mysql的 skip-grant-tables 模式

把“skip-grant-tables”删除或者注释掉。

6、重启mysql服务

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容