Reputation: 2203
I have a mysql server on a linux box (192.168.1.20) which has database named "retail". I want to create an automatic way to do a backup on windows server (192.168.1.30).
What is the best way to run the following code to do so :
mysqldump -h 192.168.1.20 -u root -p Retail > C:\Retail_Initiative\backup_20110315.sql
Any kind of help will be greatly appreciated.
Upvotes: 2
Views: 1116
Reputation: 6992
How about creating a bat file with:
/START /WAIT mysqldump -uUSERNAME -pPASSWORD -h192.168.1.20 retail > path_to_dump_file
/START /WAIT mysql -uUSERNAME -pPASSWORD -h192.168.1.30 -e "DROP DATABASE retail; CREATE DATABASE retail;"
/START /WAIT mysql -uUSERNAME -pPASSWORD -h192.168.1.30 retail < path_to_dump_file
That should do it.
Upvotes: 2