Mysqldump: received error: 1045 Access denied

I logged into an AWS instance and tried to copy the mysql database to a .sql file. I use the command:

mysqldump -u [username] -p [databasename] > [database].sql

Then enter the password and the following message.

"mysqldump: Got error: 1045: Access denied for user '[username]'@'localhost' (using password: YES) when trying to connect."

I can log in directly to mysql using the same credentials as above, but still getting the same error. I tried a bunch of different ways for the command above, but this seems to be a problem with permissions or something like that. The user has all privileges for the database when searching in phpmyadmin, so I'm not sure what is wrong? Any suggestions? Thanks

+4
source share
3 answers

This works for me:

mysqldump -uroot -pxxxx dbname > dump.sql

or you can specify the host:

mysqldump -h localhost.localdomain -uroot -pxxxx dbname > dump.sql

Make sure you don't have different mysql instances

+5

! , . -h, "localhost" . , , IP- AWS.
mysqldump -h [PrivateIPAdress] -u [UserName] -p [DatabaseName] > [Database].sql

+3
mysqldump -u [username] -p
ENTER YOUR PASSWORD
USE [databasename]
SOURCE /path/to/[database].sql

I’m not sure, but it’s worth a try, because you said that you can enter this car.

+1
source

Source: https://habr.com/ru/post/1541159/


All Articles