Mysqldump - Access denied to user

When I run the following command from the open Windows command shell (Win7), it works fine and the backup is written to my file system. The MySQL database is located 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 in the batch file (whatever.bat) and run the bat file (with the pause command at the end), I get the error message "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 an open command shell, but not when launched from a bat file? How can I do this job?

+3
source share
5

, : -p'password'.

:

"mysqldump" -h *******.com -u ******* -p'*****' --databases ******* > "C:\******\_Database\backups\DB_%date:~0,3%.bak"
+6

. 4 , . , - root. , ^ . , ! ^ .

+3

, . : 4 $5% 6 ^^ 7 ^ & deZeYPdx5014VB3#

, . Windows. , %, . , , , bat cmd .

+1
source

Have you tried --user=**** --password=****?

I remember that I had problems getting mysqldump to get the username and password in the scripts and it turned out that this parameter worked. Sorry, but I'm afraid that I can no longer remember what problems were or what caused them ...

0
source

The following worked for me, previously the password was not accepted, so I tried it without quotes around the password ...

This is what I used mysqldump -h localhost -u username -ppassword --databases data_name> "C: \ backups \ dbbkup.% DATE: / =%. Bak"

0
source

All Articles