mysqldbcompare访问被拒绝,但mysql命令有效 [英] mysqldbcompare access denied but mysql command works

查看:269
本文介绍了mysqldbcompare访问被拒绝,但mysql命令有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用mysqldbcompare工具,但出现连接错误:

I'm trying to use the mysqldbcompare tool but getting a connection error:

$ mysqldbcompare --server1=client --skip-data-check db1:db2
# server1 on <ip>: ...
ERROR: Access denied for user 'root'@'<ip>' (using password: YES)

我可以使用mysql并很好地连接.我使用mysql_config_editor --host=<ip> --user=root --port=3306 --password设置了凭据,并在没有传递所有args(mysql -u root -p -h <ip> -P 3306)的情况下使用mysql命令进行了测试.

I can use mysql and connect just fine, though. I setup my creds using mysql_config_editor --host=<ip> --user=root --port=3306 --password and tested with the mysql command with and without passing all the args (mysql -u root -p -h <ip> -P 3306).

我已经检查了服务器的绑定地址,并查看了服务器错误日志,但它只是重申了连接被拒绝的消息.我已经在网上搜索(并在SO上搜索),但找不到任何东西.

I've checked the bind address of the server and looked in the server error logs but it just reiterates a connection refused message. I've searched online (and on SO) but haven't been able to find anything.

感谢您的帮助.

推荐答案

当您遇到访问被拒绝的错误时,它表示 TCP连接已建立,但是您提供的密码错误for 'User'@'Host' (用户-主机对是用于MySQL身份验证的真实帐户,而不是单个用户名).

When you encountered an access denied error it means the TCP connection has been established, but the password you provided is wrong for'User'@'Host'(a User-Host pair is a real account for MySQL authentication, not a single username).

假定MySQL服务器在172.0.0.8上运行,并且您的本地地址为172.0.0.5.

Assume that MySQL server runs on 172.0.0.8 and your local address is 172.0.0.5.

  1. 通过以下方式查看mysql.user:SELECT * FROM mysql.user\G;.如果找不到以下两个用户-主机对之一:'root'@'172.0.0.5''root'@'%',则意味着没有这样的帐户.所以你失败了.
  2. 还要从上面的输出中检查已存在的User-Host对的密码.
  3. 现在,连接很好,该帐户存在,密码正确,出现这种错误的唯一机会是:mysqldbcompare没有使用您提供的参数!
  4. 尝试其他解决方法,例如:mysqldbcompare --server1=root:password@172.0.0.8:3306 --skip-data-check db1:db2
  1. Take a look at mysql.user by: SELECT * FROM mysql.user\G;. If you can't find either of these two User-Host pairs: 'root'@'172.0.0.5' and 'root'@'%', it means there is no such account. So you failed.
  2. Also check the password of the existed User-Host pair from the output above.
  3. Now, the connection is fine, the account exists, the password is right, the only chance for such an error is: mysqldbcompare didn't use the arguments you provided!
  4. Try other workaround like: mysqldbcompare --server1=root:password@172.0.0.8:3306 --skip-data-check db1:db2

逐步检查所有这些内容,您会弄清楚.

Check all these stuff step by step, and you will figure it out.

这篇关于mysqldbcompare访问被拒绝,但mysql命令有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆