This is a tricky one, I have the following output:
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
When attempting to export my database with mysqldump
on Windows XP. The username is root, the password is correct and contains only alphanumeric characters. I have tried different cases, with/without quotes, specifying using -u
and -p
, specifying using --user=
and --password=
and other methods of specifying user/passwords etc, specifying the host (it's all local) and even specifying the database using --databases
instead of just blank. The error is always the same when using a password and always the same except the "NO" message when without. I have tried many fixes found through searches with no success. One fix suggested inspecting mysql.conf, but the Windows build doesn't seem to have one. The credentials (and indeed commandline parameters) work perfectly with mysql.exe - this problem only seems to be affecting mysqldump.exe.
Many thanks for your help.
For MAMP PRO users (or anyone who's mysql is in a weird location) be prepared to specify the mysql full path from the boonies and also specify full path to your user local folder where you want to dump the file or you'll get the "permission denied error"..
Following worked for me after 3 hours of research:
Don't enter the password with command. Just enter,
mysqldump -u (username) -p (db_name) > (backup_file).sql
Then you will get a prompt to enter password.
Try to remove the space when using the -p-option. This works for my OSX and Linux mysqldump:
I discovered a running apache process acessing the MYSQL causing this error. So I suggest to ensure that all processes which might interact with the DB are shutdown beforehand.
Mysql replies with Access Denied with correct credentials when the mysql account has
REQUIRE SSL
onThe
ssl_ca
file (at a minimum) had to be provided in the connection paramiters.Additional ssl parameters might be required and are documented here: http://dev.mysql.com/doc/refman/5.7/en/secure-connection-options.html
Also posted here https://stackoverflow.com/a/39626932/1695680
This worked for me
after issuing the command it asks for a password:
entering the password will make the dump file.