0

I use Ubuntu with a mariadb database.

I want to make a mysqldump of my sql databases, but i get allways the following error:

mysqldump: Got error: 1045; "Access denied for user 'db_user-backups'@'localhosts' (using password: YES)" when trying to connect

The command that throws this error is following:

sudo mysqldump --defaults-file=/etc/mysql/my.cnf lom

I have allready added the username and passwort to /etc/mysql/my.cnf and made shure the cnf file has the right permissions:

[mysqldump]
user=db_user_backups
password=MyS3cretP4ssw0rD!

The username and password is correct, I can login with my sql client.

Does anyone have an idea whats im doing wrong?

(btw: please forgive me im a linux beginner ^^')

2 Answers 2

1

With error "Access denied for user 'db_user-backups'@'localhosts'. You can connect to db and grant permission for user 'db_user-backups' with command example:

Connect to Mysql: mysql -u root -p:

GRANT ALL PRIVILEGES ON *.* TO db_user-backups@'localhosts' IDENTIFIED BY 'password' with grant option;

flush privileges;

After you can reconnect with mysqldump.

0

Try specifying the port. I'm using MySQL 8.0 on Windows but similar issues apply on Ubuntu. Without a port argument I got the same error:

C:\Users\user>mysqldump -u root -p airlines_test > C:\...\test\airlines_test_dump.sql
Enter password: ******************
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

I fixed this by specifying the port to use: -P 3306:

C:\Users\user>mysqldump -u root -p -P 3306 airlines_test > C:\...\test\airlines_test_dump.sql
Enter password: ******************

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.