error: 'Access denied for user 'root'@'localhost' (using password: NO)'


mysql5.7报错信息:

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

解决办法:

第一步:

#systemctl stop mysqld.service

关闭mysql服务

 

第二步:

#vim /etc/my.cnf

打开mysql配置文件

 

第三步:

最后面加入  

 

第四步:

#systemctl start mysqld.service

打开MySQL服务

 

第四步:

mysq -hlocal -uroot

use mysql

update user set authentication_string='NewPassword' where user='root';

免密登录mysql

选择mysql数据库

更新root用户密码

 

第五步:

停止mysql #systemctl stop mysqld.service

删除配置文件添加的“skip-grant-tables”这句话

然后启动mysql 

再次等输入密码即可

 

 

 

 

欢迎进群讨论:QQ群294668383(有意向可以添加)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM