An example of a MySQL database dump backup is described below.
- MySQL server installation, including mysqldump.exe
- Some dump space on disk that needs to be included in the selection.
- Permission to write to the dump location. This may need to be explicitly granted to the Backup Pro service user.
- A user with sufficient rights to backup MySQL.
1. Create the script
Create a batch file containing the following:
cd <path to MySQL bin folder>
mysqldump --opt -h <hostname> -u <user> --password=<password> <database name> > <dump path out>
If backing up "Engineering" to C:\MySQLDump\Engineering.txt using the username "redstor" and password "Password123":
cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
mysqldump --opt -h localhost -u redstor --password=Password123 engineering > C:\MySQLdump\engineering.txt
Back up multiple databases
Should you wish to backup multiple databases, these can be specified by repeating the "mysqldump" command with different database names and filenames.
mysqldump --opt -h localhost -u redstor --password=Password123 finance > C:\MySQLdump\finance.txt
Note: Use a static filename for dumped MySQL backup files (.txt in the examples above), so that files will be patched and not added as new files.
2. Test the script
It is strongly recommended that you test the backup script from the command line before adding it to the backup client for execution.
3. Configure the script in the backup client
Add the script to the backup client configuration, set to run before each backup.
4. Add the script to the backup selection
Ensure that the dump locations are included in the backup selection.