Eu sofri o mesmo comportamento estranho.
Quando eu uso no meu script o comando:
/usr/bin/mysqldump -h localhost -u root -pmy#rootpassword mysql --tables db >> mysql-db_2017-03-17_09-50-35.sql
Eu recebo o aviso:
Warning: Using a password on the command line interface can be insecure.
Então eu mudei meus scripts de backup para
/usr/bin/mysqldump --login-path=backups mysql --tables db >> mysql-mysql-db_2017-03-17_08-24-07.sql
Mas isso me deu o erro:
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
A documentação oficial do MySQL recomenda testar a Configuração com o comando "mysql"
link
To connect to the local server, use this command:
shell> mysql --login-path=client
E, na verdade, descobri que recebo o mesmo erro dessa maneira:
$ mysql --login-path=backups
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Eu não conseguia entender nada até me deparar com este comentário na parte inferior da documentação do MySQL:
Password string with character "#" in it will cause authentication failure because when strings are read, hash characters are treated as the start of a comment.
Isso me levou à página de bugs do MySQL: link
Lá encontrei a solução sugerida que funcionou para mim:
A workaround is to enter the password in quotes "pass#pass".
Suggested fix:
Enclose all strings in quotes.
Então eu digitei minha senha no "mysql_config_editor":
$ mysql_config_editor set --login-path=scripts --host=localhost --user=root --password
Enter password: -> typeing: "my#rootpassword" <- including the character >"<
WARNING : 'scripts' path already exists and will be overwritten.
Continue? (Press y|Y for Yes, any other key for No) : y
E finalmente o Login teve sucesso:
$ mysql --login-path=scripts
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 139
Server version: 5.6.35-log Distributed by The IUS Community Project
Copyright (c) 2000, 2016, 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> exit
Bye