How to Reliably Backup mySQL Repository so it can be Restored if Needed

The ForceField repository is implemented as a mySQL database on  the server.

Over time I have discovered that one cannot backup the mySQL database folder, restore it to another machine, and have it work reliably.

The reason is unknown, but the solution is clear:  One must produce a .sql (i.e. text) file of the mySQL databases and then run the .sql file on the new machine to populate the new mySQL installation. (i.e. "dumping and reloading" via text files).

To this end, I have learned how it's done using the mySQL Workbench. I also wrote a simple .bat script which can be run from the Task Scheduler to automate this task and run periodically as desired.

Script (all on one line):

set name=all_databases_%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%-%time:~9,2%.sql
set name=%name: =0%
mysqldump --user=root --password=Jargons0ft5555 --all-databases  >  %name%

Article Details

Article ID:
220
Category:
Date added:
2014-07-17 15:27:17
Views:
399
Rating (Votes):
(562)