美文网首页后台学习
MySQL5.7数据库连接报1045[Access denied

MySQL5.7数据库连接报1045[Access denied

作者: 菠萝蜜朵弦 | 来源:发表于2020-01-17 11:57 被阅读0次
    • 找到mysql.ini文件,在[mysqld]下边加上skip-grant-tables
      配置文件.png
    image.png
    • 添加后就忽略了密码验证,直接登录然后输入密码:mysql -u root -p


      image.png
    • 修改root密码
     update user set authentication_string=password('123456')
     where user='root';
    
    image.png

    这里要注意的是 mysql5.7以前的密码字段是password,5.7用的是authencation_string字段,如果是5.7以前的版本,要改成

     update user set password=password('123456')
     where user='root';
    
    • 修改成功后,把mysql.ini文件中的skip-grant-tables注视掉
    • 重启mysql的服务

    相关文章

      网友评论

        本文标题:MySQL5.7数据库连接报1045[Access denied

        本文链接:https://www.haomeiwen.com/subject/igthtctx.html