Backup and restore MySQL database


The following command will backup your database.

Note: make sure the destination folder is created (e.g. c:\backups)

1. Open the command line (by typing "cmd" on the start menu).

2. Enter the following command:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --database GpsGateServer --single-transaction -h localhost -ppassword -u root > C:\backups\GpsGateServer.mysqldump

You can then schedule this command to be executed once per day, preferably at night using "Scheduled Task" feature you find in the Windows Control Panel.

It is recommended that you make the backup to a network drive (and not C: as in the sample above). First, it will increase performance to not write down the backup to the same disk as the original database. And secondly you should have the backup on a separate server, if possible, off site.



"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" --database GpsGateServer -h localhost -ppassword -u root < C:\backups\GpsGateServer.mysqldump

Additional notes

  • password is your root MySQL password set in the installation steps.
  • Replace 5.5 with the version of MySQL you have installed. If you installed MySQL as part of the setup Wizard you have 5.5 installed.