1

I have created a user callsed "backup" for my MySQL Database, and given it a specific password.enter image description here

and I'm now trying to execute this command:

sudo mysqldump --user=backup -password=SuperS3f@kePass --all-databases > all_databases.sql

resulting in these errors:

mysqldump: Got error: 1045: Access denied for user 'backup'@'localhost' (using password: YES) when trying to connect

I have tried with the root mysql user, and without sudo as well, getting same error

MySQL version: mysql Ver 14.14 Distrib 5.7.22 on an Ubuntu 17.10

1 Answer 1

4

It's probably explained by this:

Host wildcard does not match 'localhost'

And that is related to the fact that for mysql connecting to localhost really means connecting to an UNIX socket (probably /var/run/mysqld/mysqld.sock), while connecting to 127.0.0.1 means connecting (using IPv4) to localhost. So they chose to distinguish their access rights.

To check this is the case, try again with:

sudo mysqldump  -h 127.0.0.1 --user=backup -password=SuperS3f@kePass --all-databases > all_databases.sql

Then correct the access rights (eg to 'backup'@'localhost') instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .