How to Backup MariaDB on Synology [Detailed Steps]
Using Synology with MariaDB for backups can provide automated and scheduled backups, snapshot and versioning support, and flexible backup destinations. Several methods can backup MariaDB on Synology.
MariaDB is a powerful open-source database management system commonly used in applications that require structured data storage. If you run MariaDB on your Synology NAS, regular backups are essential to prevent data loss or failures due to various disasters. In this article, we will provide detailed instructions on how to back up MariaDB databases on Synology and the steps to restore a MariaDB backup.
Why Backup MariaDB on Synology
After setting up MariaDB backup, it can help you effectively avoid the following effects:
- Data corruption caused by accidental shutdown or power failure.
- Accidental deletion of tables or records.
- Hardware failure that leads to data loss.
- Ransomware attacks may encrypt or corrupt databases.
Methods to Backup MariaDB on Synology
There are several ways to back up the MariaDB database on Synology, including built-in tools and command line methods.
Method 1. Using phpMyAdmin (Graphical Interface)
If you prefer a graphical user interface, phpMyAdmin is a simple tool for exporting and backing up your database.
1. Access phpMyAdmin
- Open Synology DSM and go to Package Center.
- Install and open phpMyAdmin.
- Log in using your MariaDB credentials.
2. Select a Database
In phpMyAdmin, select the database you want to back up from the left panel.
3. Exporting a Database
- Click the Export tab.
- Select the Quick Export method.
- Select SQL as the format.
- Click Go, and the backup file (.sql) will be downloaded.
Method 2. Using the MariaDB Command Line
For advanced users, the Command Line Interface (CLI) provides more flexibility in automating backups.
1. Enable SSH on Synology NAS
- Go to Console Panel > Terminal and SNMP.
- Enable SSH service and log in to the NAS via SSH.
2. Run the Backup Command
Export the database using the mysqldump command:
3. Automate with a Schedule Task
- Open Control Panel > Task Scheduler.
- Click Create > Schedule Task > User-defined script.
- Add the following script:
- Schedule it to run at a convenient time.
Method 3. Backing Up with Hyper Backup
Synology’s Hyper Backup can back up MariaDB along with other system files.
- Open Hyper Backup from DSM.
- Click Create > Data Backup Task.
- Choose a backup destination (local, external drive, or cloud).
- Select MariaDB and any other application settings to back up.
- Configure backup schedules and retention policies.
- Click Apply to start the backup.
Restore MariaDB Backup
If you need to restore a backup, use one of the following methods:
Method 1. Using phpMyAdmin
- Open phpMyAdmin.
- Select the database you want to restore.
- Click the Import tab.
- Choose the .sql file and click Go.
Method 2. Using CLI
- Upload your backup file to the NAS.
- Run the following command:
Method 3. Using Hyper Backup
- Open Hyper Backup.
- Select your backup task.
- Click Restore and choose the desired backup version.
Best Practice for Backup MariaDB on Synology
- Automate backups to prevent data loss due to human error.
- Store backups externally, such as on a cloud service or another NAS.
- Encrypt sensitive backups to protect confidential data.
- Test restoration periodically to ensure backup integrity.
To Secure Your Data Using An Efficient Backup Tool
To save your data from being lost and keep it safe in case of any disaster or error, you can use AOMEI Cyber Backup, a professional backup software that offers virtual machine (VM) backup, SQL database internal partitioning, system backup, and many other backup options. It has an intuitive interface that allows you to operate it effortlessly, and it also offers you flexibility in your backups with a variety of features.
Agentless Backup: You can back up virtual machines at the host level without installing agents on each VM, reducing O&M.
Automate VM Backup: You can run VM backup automatically to offer continuous VM protection and reduce human error.
Instant Disaster Recovery: Once the VMware crashes, quickly restore VMware to its normal state and easily migrate the VM to another host.
Role-Assignment: It allows one administrator to create subaccount with limited privilege, effectively reducing administration costs and manual errors.
Incremental and Differential Backup: You can create incremental and differential SQL backups to back up only newly added data or changed data to save time and space.
Free, easy, centralized, enterprise data backup solution.
Conclusion
Backing up MariaDB on Synology NAS is essential for data security and disaster recovery. Synology MariaDB backup can be achieved using some of the methods provided in this article: phpMyAdmin, command line, or Hyper Backup, all of which are reliable backup strategies to ensure database security and recoverability.