Backup and restore MySQL database
The following command will backup your database.
Note: make sure the destination folder is created (e.g. c:\backups)
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.
1. Before restoring the database, you can check if Mysql has an appropriate configuration on buffer size. That could make the restoring process quicker and the performance of the Mysql could be better. Please follow this guide to config your Mysql.
2. Then you can run the command as below to restore your database dump file.
"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" --database GpsGateServer -h localhost -ppassword -u root < C:\backups\GpsGateServer.mysqldump
- 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.