How to Back Up MySQL Database using CloudBerry Backup

Introduction

The main point is that you need a script for the MySQL database backup that CloudBerry Backup will run prior to uploading the backup to the cloud. Below there is a step-by-step guide for the MySQL backup with CloudBerry Backup.

Setting Up a MySQL Database Backup

Step 1. Choose a temporary storage and create a folder for your backup files. For example, a C:\MySQLBackup\ folder.

Step 2. Write a script that will create a backup of your MySQL database. You can see an example below (where the database name is “test”; "root / p1234" is a login account to MySQL):

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe" -u root -p1234 test > C:\MySQLBackup\testbackup.sql

Save this command as C:\MySQLBackup\MySQLBackup.bat.

Note: Please replace “1234” with your root password and “test” with the name of the database that you want to back up. Also, the “mysqldump.exe” location can be different in your environment.

The mysqldump command will connect to the database called “test” under the root user and will generate a text “dump” of the selected database. These dumps are just files with all the SQL commands needed to recreate the database from scratch.

Step 3. Launch CloudBerry Backup then click on the "Backup Files" button in the top menu.

Specify the Backup Source. Here you need to choose the folder created in Step 1. If it is a network share, don't forget to specify your network credentials in “Tools | Network Credentials”.

Step 4. We strongly recommended to include empty folders and hidden/system files into your backup to fully keep the MySQL database structure.

MySQL Backup Filter

Step 5. On the Pre/Post Actions step, you need to specify the script created in Step 2. It will be executed before the backup job runs.

MySQL Backup Actions

Note: If you don't want to store the results of the “mysqldump” backup after you have uploaded it to the cloud, you can create the BAT file that will delete those files. Learn more at https://www.cloudberrylab.com/blog/deleting-files-from-local-storage-after-a-successful-backup/

Step 6. Run your backup plan, and it will execute a pre-action that creates a copy of your database and push it to the cloud afterward.

Summary

CloudBerry Backup allows to back up MySQL databases to any cloud storage. Its Pre/Post Action step automatically creates a “mysqldump” backup of your database and then it uploads the backup to the cloud.

Note: You can skip the Pre/Post Actions and intermediate folder steps if you manually execute the mysqldump.exe, and then specify the folder with MySQL backup data when creating a backup plan in CloudBerry Backup.