0

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?

Shadow
  • 33,525
  • 10
  • 51
  • 64
SiddheshNan
  • 90
  • 1
  • 9
  • You are providing the setting `host` and `socket` at the same time, which doesn't make sense. What error messages do you get when you use `mysqladmin -h localhost -uroot -pmysupersecretpass`? – Progman Sep 14 '19 at 08:33

1 Answers1

2

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.

Georg Richter
  • 5,970
  • 2
  • 9
  • 15