While using mysqladmin --defaults-file=/etc/mysql/debian.cnf
, mysqladmin fails with following error:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
But if I try to login using username and password like: mysqladmin -uroot -pmysupersecretpass
it works.
Contains of /etc/mysql/debian.cnf
[client]
host = localhost
user = root
password = mysupersecretpass
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password = mysupersecretpass
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
However I am also able login using mysql -u root -p
.
can anyone tell me what's wrong with /etc/mysql/debian.cnf
?
You need to add doublequotes around your password.:
password="mysecretpw"
Without double quotes it wouldn't be possible to read special chars in your password.