微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

mysql登陆ERROR 1045 (28000): Access denied for user

Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

报错信息显示useing passowrd:YES 说明密码是对的,但是拒绝用户root登陆
找到MysqL配置文件进行修改

mysql登陆ERROR 1045 (28000): Access denied for user

添加skip-grant-tables表示跳过密码验证登陆
然后重启MysqL服务

systemctl restart mariadb.service

然后跳过密码登陆MysqL

MysqL -uroot -p
Enter password: 不用输入密码

然后进入MysqL数据库进行修改root密码:

MariaDB [(none)]> use MysqL;
MariaDB [MysqL]> update user set password=password("000000") where user="root";
MariaDB [MysqL]> flush privileges; //刷新权限表
MariaDB [MysqL]> quit

修改my.conf配置文件把刚才配置的skip-grant-tables去掉
然后重启MysqL服务验证密码登陆:

systemctl restart mariadb.service
MysqL -uroot -p000000
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.17-MariaDB MariaDB Server

copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

OK,成功登陆进来。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐