How can I make MySQL client read password from mylogin.cnf?
use following command to set login path first
mysql_config_editor set --login-path=lgpath --user=root -p
password
and then use below command to login mysql
mysql --login-path=lgpath
Help about mysql login path options can bee seen by
mysql_config_editor set --help
I had the same issue as OP, but the answers in this thread confused me. Vinay Mandala's link actually worked for me. Reposted here for clarity.
My issue:
ERROR 1045 (28000): Access denied for user '<user>'@'<host>' (using password: NO)
It proves that mysql_config_editor
does not handle special characters in the password properly.
Solution:
When mysql_config_editor
prompts you for the password, make sure that you surround the password in double quotes ("). Afterwards, you can login just fine.