Mysqldump/ Automating daily in windows

I need to do mysql backups on the server and store them in a location that is backed up daily. What is the command line prompt to do so in windows for mysqldump. Also, I need to have this done automatically daily. How do I go about doing so?
kbreaux25Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

michofreihaCommented:
In order to do that you should create a batch file where you'll put the following code:

mysqldump --opt -uUSERNAME -pPASSWORD DATABASE_NAME > "C:/path/to/dump/file.sql"

This batch file should be located in c:\path\to\mysql\bin
Regarding how to run it daily go to controlPanel-->Scheduled Tasks--> then add anew task and choose the date of running
0
kbreaux25Author Commented:
I can get the command to work if i dont specify a path and only the db.sql name for the output, but the command

mysqldump opt uUSERNAME -pPASSWORD DB NAME > "D:\pathname"

returns an error that it can't find the path specified
0
michofreihaCommented:
please let me know the full path o your MySQL which mean where is the mysql folder is located?
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

kbreaux25Author Commented:
mysql is located in c:\program files\mysql\mysql server5.0\bin. I need to put the backup file on a different drive that is backed up daily.
0
michofreihaCommented:
let's do a test before:

1- Start
2- Run and type cmd
3- cd c:\program files\mysql\mysql server5.0\bin
4- ./mysqldump --opt -uroot -pPassword Database_Name > "c:\program files\mysql\mysql server5.0\bin/dump.sql"

Please do that and let me know if dump.sql is created under the bin folder
0
kbreaux25Author Commented:
ran the command and returns couldnt find the path specified
0
michofreihaCommented:
are you sure that mysqldump figure in the bin folder?
0
kbreaux25Author Commented:
Yes when i type mysqldump ....command .. > dbname.sql. It successfully dumps the file to the bin directory, i just can't seem to be able to enter a path name.
0
adrpoCommented:

You could use -r file, instead of the redirect:
It might works better.

mysqldump opt uUSERNAME -pPASSWORD DB NAME -r d:/pathname
Is actually recommended for windows. Read here:
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html#option_mysqldump_result-file

Cheers,
za-k/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kbreaux25Author Commented:
That seems to work. However I get an errcode 2 can't create file or directory when i try to put the file on the d drive but i can put it on the c drive. Perhaps something I should talk to the network guy about?
0
adrpoCommented:

Can you create files on d:\?
Do you have full permisions on this [network] drive?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.