Remote mysql backups on windows
In our day to day job needs to backup remote mysql database and sometimes may needs to synchronize with another one.
It can be done by using following code snippet, no matter the remote server is windows or Linux.
Save the following code snippet as a batch(.bat) file and setup a task scheduler.
set DATET=%date:~-4%_%date:~7,2%
"your mysql bin directorymysqldump" --host="remote-host" --user="remote-database-user" --password="remote database password" remote-database-name > "backup-directory"backup_%DATET%_csv.sql
"your mysql bin directorymysql" -uuser -ppassword -t csv < "backup-directory"backup_%DATET%_csv.sql