Batch File SQL "Got error: 1045:"

Batch File SQL "Got error: 1045:"

by Steve Audus -
Number of replies: 4

Can anyone help please,

I am running moodle on a Windows 2003 server, on Apache with MYSQL.

When I use this command

D:\backup>d:\mysql\bin\mysqldump --user=root --password=***** moodle  1>D:\backup\moodledump.sql

From the command line it works great,

but when I include the line in a .CMD batch file for scheduling, the command returns this error.

D:\backup>d:\mysql\bin\mysqldump --user=root --password=***** moodle  1>D:\backup\moodledump.sql
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using pas
sword: YES) when trying to connect

Thank you.

Steve

Average of ratings: -
In reply to Steve Audus

Re: Batch File SQL "Got error: 1045:"

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
I created a nice batch file that does this a while back that might do this better for you - check it out here:
http://moodle.org/mod/forum/discuss.php?d=80948
In reply to Dan Marsden

Re: Batch File SQL "Got error: 1045:"

by Steve Audus -

Thank you, Dan

I did try your script, but got the same error.

D:\backup>sqlbackup.bat
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using pas
sword: YES) when trying to connect
'gzip' is not recognized as an internal or external command,
operable program or batch file.

Also what is gzip?

Thanks again

Steve

In reply to Steve Audus

Re: Batch File SQL "Got error: 1045:"

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi Steve - are there any spaces in your password or username? - make sure you keep the quotes in the original file I sent through.

also are you typing in "'root'@'localhost'" as your username? - try just "root"

Mysql dump files are way too big to keep in their original condition for backup purposes. - gzip is a free compression tool used very extensively when compressing server logs/backup files etc...

you can get it from here:
http://www.gzip.org/

I normally dump it somewhere like windows/system32 on windows servers I use so that it can be called anywhere on the command line.
In reply to Dan Marsden

Re: Batch File SQL "Got error: 1045:"

by Steve Audus -

Dan, Thank you for helping me with this, but I still can't get it to work.

I have put back the quotes around the password, which is quite strong as it contains numbers, upper and lower case letters, an underscore and a percentage symbol, but no spaces.

I also tried using root@localhost, instend of just root, but got this error.

D:\backup>sqlbackup.bat
mysqldump: Got error: 1045: Access denied for user 'root@localhost'@'localhost'
(using password: YES) when trying to connect

I'll get gzip.

Thank you again for your help with this.

Steve