mysqldbcompare access denied but mysql command works

旧时模样 提交于 2019-12-23 11:13:12

问题


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)

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).

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.

Any help is appreciated.


回答1:


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).

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

  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.




回答2:


I think this command of mysql compare don´t use the default config, try to force the user and password into the command line.



来源:https://stackoverflow.com/questions/47295981/mysqldbcompare-access-denied-but-mysql-command-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!