Access to mysqldbcompare is denied, but mysql command works

I try to use the mysqldbcompare tool, but I get 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 just connect. I set my credits using mysql_config_editor --host=<ip> --user=root --port=3306 --password and tested using the mysql command with all arguments passed ( mysql -u root -p -h <ip> -P 3306 ) and without them.

I checked the server binding address and looked at the server error logs, but it just repeats the connection failure message. I searched on the Internet (and so on), but could not find anything.

Any help is appreciated.

+5
source share
2 answers

I think this mysql comparison command does not use the default configuration, try forcing the user and password into the command line.

0
source

When you encounter a denial of access error, it means a TCP connection has been established , but the password you provided is incorrect for 'User'@'Host' (a pair of host users is a real account for MySQL authentication, not just one username).

Suppose your MySQL server is running at 172.0.0.8 , and your local address is 172.0.0.5 .

  • Take a look at mysql.user at: SELECT * FROM mysql.user\G; . If you cannot find either of these two User-Host pairs: 'root'@'172.0.0.5' and 'root'@'%' , this means that there is no such account. So you could not.
  • Also check the password of the existing Host-Host pair at the output above.
  • Now the connection is perfect, the account exists, the password is right, the only chance for such an error: mysqldbcompare did not use the arguments you provided!
  • Try a different method: mysqldbcompare --server1=root: password@172.0.0.8 :3306 --skip-data-check db1:db2

Check all these things step by step and you will find out.

0
source

Source: https://habr.com/ru/post/1273373/


All Articles