首页 > 数据库技术 > 详细

Mysql5.7 CentOS7 报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

时间:2019-01-22 12:51:35      阅读:1501      评论:0      收藏:0      [点我收藏+]

环境 Mysql5.7.24  CenOS 7.3.16

解决方案:

第一步:

#systemctl stop mysqld.service

关闭mysql服务

 

第二步:

#vim /etc/my.cnf

打开mysql配置文件

 

第三步:

最后面加入  skip-grant-tables

 

第四步:

#systemctl start mysqld.service

打开MySQL服务

 

第四步:

mysq -hlocal -uroot

use mysql

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

免密登录mysql

选择mysql数据库

更新root用户密码

 

第五步:

删除第二步的语句

-------------------------------------------------------------------------华丽的分割线

附录:mysql重要配置文件    etc/my.cnf

查看linux版本   uname  -a  或 cat /etc/redhat-release

查看mysql版本 select version()

Mysql5.7 CentOS7 报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

原文:https://www.cnblogs.com/liu-cheng-biao/p/10303178.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!