ERROR 1045 (28000): Access denied for user 'backup'@'mysql' (using password: YES)
mysql远程连接时提示失败
[root@mysql ~]# /usr/local/mysql/bin/mysql -ubackup -p123456 -h 192.168.6.36
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user ‘backup‘@‘mysql‘ (using password: YES)
原因:我通过装好MySQL的虚拟机,克隆并修改了主机名,导致远程无法登陆;
[root@mysqlslave ~]# mysql
mysql> select user,host from mysql.user;
+------------+-----------+
| user | host |
+------------+-----------+
| backup | % |
| test | % |
| backup | 127.0.0.1 |
| root | 127.0.0.1 |
| ebnewslave | 192.168.% |
| root | ::1 |
| | localhost |
| backup | localhost |
| root | localhost |
| test | localhost |
| | mysql |
| root | mysql |
+------------+-----------+
解决方法:
修改root用户和“ ”对应的host为原机器名的值
update mysql.user set host=‘mysqlslave‘ where user=‘root‘ and host=‘mysql‘;
update mysql.user set host=‘mysqlslave‘ where user=‘ ‘ and host=‘mysql‘;
flush privileges ; ---注,如果不刷新权限和重启数据库,权限是不生效的。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。