This is a tricky one, I have the following output:
mysqldump: Got error: 1045: Access denied for user \'root\'@\'localhost\' (using password: YES) when tr
For me it worked when I omitted the password.
So mysqldump -u user dbname > dump.sql
I had the same error for last 2 days. Tried bunch of things. Nothing worked.
But this did work:
Create another user. Grant it everything.
mysqldump -u new_user db_name > db_name.sql
//no error
I was having the same issue, for 30min! I found that I was using _p
instead of -p
, the terminal font confused me!
This solution might be one of the last to try/least likely to be the culprit, but this was my problem...
My problem was that the directory I was trying to dump to needed admin privileges to write to and that's what was causing the mysqldump
command to return "Access Denied"
.
I set the dump file path to my desktop dir and then it worked.
This was on Windows.
Go to Start-> All Programs -> Accessories right click on Command Prompt click on Run as administrator
In the command prompt using CD command Go to MySQL bin folder and run the below command
mysqldump --user root --password=root --all-databases>dumps.sql
it will create dumps.sql file in the bin folder itself.
In Past same problem occurred to me after I copied the mysqldump statement from a MS Word file.
But When typing the statement directly, everything worked fine.
In hex editor the "-" of the not working statement was represented by the unicode char e2 80 93 (http://www.fileformat.info/info/unicode/char/2013/index.htm)
In sort, type password directly and check the copy paste code as the uni-code (or other encoding) strings might cause an issue..