XAMPP: Using MySQLDump to Backup MySQL on Windows Server 2003 and Windows 7

I couldn’t find anything specific for Backing up the MySQL Databases within XAMPP. There certainly isn’t a pre-configured routine available. In addition, MySQL Workbench (unlike its predecessor MySQL Administrator) does not provide any automated backup facility.

So, I decided to explore the use of “MySQLDump”, a command line routine that can be inserted into a batch file and executed as a “Scheduled Task”. “MySQLDump” is included as part of XAMPP and is found within “<path to XAMPP>\MySQL\bin\”.

Here is the basic syntax I used (from a command prompt):

<path to XAMPP>\MySQL\bin\MySQLDump –u root –p myrootpassword –result-file=”<path to Backup Folder>\MySQLDump.sql” –all-databases

I then copied this into a batch file (MySQLDump.bat) and used “System Tools => Scheduled Tasks” (Task Scheduler in Windows 7) to run the batch file each evening.

Of course, you must ensure that the “MySQLDump.sql” file itself is stored in a safe location and can be recovered in case of server failure / building loss.

Advertisements

3 thoughts on “XAMPP: Using MySQLDump to Backup MySQL on Windows Server 2003 and Windows 7

  1. Hello. Many thanks for the feedback.

    There are TWO DASHES before “result-file” and TWO DASHES before “all-databases”. For some reason, WordPress seems to have merged these into a single dash when the blog was published.

    Also, if you save your batch file into the “mysql\bin” directory, you don’t need to type the path of the “mysqldump” executable.

    Get back to me if you are still struggling. Kind regards, Stephen

  2. Thanks so much for this. For some reason in my case I couldn’t get the -p to work with the password, but when I used the long form (two dashes) –password=mypass then it worked.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s