mysqldump - Access denied for user
Solution 1
You should escape the password using single quotes: -p'password'
.
The correct command would be:
"mysqldump" -h *******.com -u ******* -p'*****' --databases ******* > "C:\******\_Database\backups\DB_%date:~0,3%.bak"
Solution 2
I have been experiencing a similar problem. I have 4 databases all which back up fine. The 5th would not backup no matter what user I attempted with - even root. It turns out the ^ symbol in the password was the problem for me. Once I changed the users password to include ! rather than ^ everything worked immediately.
Solution 3
Ok, I figured out this exasperating thing. The problem was my password itself: 4$5%6^^7^&deZeYPdx5014VB3C#
When I changed that password, everything worked. Some character in there jacks up windows batch file execution. I suspect it's the % sign, but hard to know. Must be a bug in windows, given the fact that it works fine from command shell but not in bat file OR cmd file.
Comments
-
HerrimanCoder almost 2 years
When I run the following command from an open windows command shell (Win7), it works fine, and the backup is written to my file system. The MySQL database is on a remote linux server.
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump" -h *******.com -u ******* -p***** --databases ******* > "C:\******\_Database\backups\DB_%date:~0,3%.bak"
But when I put the same command into a batch file (whatever.bat) and run the bat file (with a "pause" command at the end), I get the error "Got error: 1045: Access denied for user 'me'@'c-24-2-64-138.hsd1.ut.comcast.net' (using password: YES) when trying to connect".
Why does it work from inside an open command shell, but not when running from a bat file? How can I make this work?