码迷,mamicode.com
首页 > 数据库 > 详细

ERROR 1045 (28000): Access denied for user 'backup'@'mysql' (using password: YES)

时间:2015-05-27 19:19:02      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:mysql远程连接时提示失败

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 ; ---注,如果不刷新权限和重启数据库,权限是不生效的。

ERROR 1045 (28000): Access denied for user 'backup'@'mysql' (using password: YES)

标签:mysql远程连接时提示失败

原文地址:http://yiqiuyu.blog.51cto.com/3228402/1655743

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!