Access denied for user 'root '@'连接的ip'(using password:YES)

来源:互联网 发布:呼死你在淘宝上叫什么 编辑:程序博客网 时间:2024/06/05 21:16

今天使用远程连接连接刚刚配好的MariaDB的时候发生了这个问题Access denied for user ‘root ‘@’连接的ip’(using password:YES)

但是到主机上使用密码连接的时候又能登录,但是那边又包密码错误。

解决方法:在要连接的主机上使用密码登陆
进入之后使用下面的命令登录

MariaDB [(none)]> use  mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedMariaDB [mysql]> select user,password,host from user;

查看你的用户密码是否一致
这里写图片描述
一开始上下localhost和%的密码不一致
所有造成无法远程连接
使用下面的命令

MariaDB [mysql]> update user set password=password('设置密码') where host='%';MariaDB [mysql]> update user set password=password('设置密码') where host='localhost';

然后就能正常登录了

0 0