您现在的位置是:网站首页>文章详情文章详情

centos7.2 mysql5.7登陆不上的解决方法ERROR 1045

inlike2019-11-25 原创文章 浏览(1778) 评论(0) 喜欢(41)

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

该方法在centos7.2 mysql5.7版本上验证过,其他版本或系统自查相应处理方式。

停止mysql服务

systemctl stop mysqld


修改配置文件无密码登录

vi /etc/my.cnf  
在最尾部加上   
skip-grant-tables 
保存并退出

启动mysql

systemctl start mysqld.service

登录mysql

mysql -u root

此处注意不要加-p

修改密码,mysql5.7用此语法

use mysql ;
update mysql.user set authentication_string=password('123456') where user='root' ;

回到第二步骤去掉加上的

skip-grant-tables

image.png

很赞哦! ( 41)
    《Python实战进阶》
    None
    None
    夏至已深

站点信息

  • 建站时间:2019-5-24
  • 网站程序:like in love
  • 主题模板《今夕何夕》
  • 文章统计:104条
  • 文章评论:***条
  • 微信公众号:扫描二维码,关注我们
  • 个人微信公众号