I installed mysql utilities on my ubuntu server today, so I could use mysqldbcompare, but I just cannot connect to the mysql server with it (localhost). I created an entry into the .mylogin.cnf, using mysql_config_editor, as mentionned into the mysql utilities 1.6 documentation, and printed / tested it (with mysql), and it's ok. But if I try to run any mysql utilities command, it always fail with
ERROR: Access denied for user '****'@'localhost' (using password: YES)
(I put the stars myself instead of my user name).
I spent more than 2 hours searching the web, I have absolutely no clue of what's wrong… any idea ?
EDIT :
alright, let's do this step by step
First, my versions. Everything is on the same virtual machine : mysql server and client, and mysql utils.
My versions are :
MySQL server : Ver 14 Distrib 5.7.22
MySQL client : Ver 14 Distrib 5.7.22
MySQL utils : 1.6.1
- First, using phpMyAdmin (which connects correctly to mysql), I create a user named userTest, with host % and password "bonjour!".
- Then, I go to my host terminal, and type the following :
mysql_config_editor set --login-path=test --host=localhost --user=userTest --port=3306 --password
- When asked, I enter the password "bonjour!"
- Then, I try to connect to mysql using the login path (no user is named "test" on the database :
mysql --login-path=test
-
This connects me to mysql correctly :
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.7.22-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
-
Now I exit mysql and type a simple mysql utils command :
mysqlserverinfo --server=test
-
And I get
ERROR: Access denied for user 'userTest'@'localhost' using password: YES
Best Answer
OK, so my suspicions were correct. The python scripts of mysql utilies use the default "my_print_defaults" utility to get the credentials from a login path. But the my_print_defaults call returns the password as a bunch of stars, unless you call it with -s... So I modified the python script mysql/utilities/common/my_print_defaults.py to call the my_print_defaults executable with -s to get the password too. And now it works.