- Having a backup of the MySQL database helps you restore the database in case of an emergency and protect sensitive data.
- In this article, we explore a few ways to backup MySQL Database automatically.
- Do explore our Software section for more recovery software recommendations.
- For more how-to guides, tips, and tricks, visit our How-to Hub.
MySQL is a popular open-source database management system for the development of websites. If you have sensitive data stored in your database, you can backup the MySQL database automatically using third-party automation solutions.
Being able to automate the MySQL database backup process allows you to simplify the backup process without relying on your team to create backups every day manually.
In this article, we explore multiple ways to back up the MySQL database automatically.
How do I backup MySQL database automatically?
1. Use Acronis Cyber Backup
Acronis Cyber Backup is a popular backup and recovery solution for businesses of all sizes. It keeps your business running, protecting any workload with endless scaling options and automation.
Acronis Cyber Backup comes with innovative security features like protective ransomware protection, instant restore, complete protection for your data, blockchain notarization, and support for hybrid cloud architecture to manage all forms of data protection.
Acronis Cyber Backup
Back up your MySQL databases easily by using this incredibly powerful and user-friendly software.
2. Backup automatically on Linux
If you are using Linux, you can use cron to backup your MySQL database automatically. Cron is a scheduling utility in Linux operating system that can-do tasks like performing automatic backups or even renew your SSL certificate.
You can use the following command to create a cron job to back up the MySQL database automatically:
15 2 * * * root mysqldump -u root -pPASSWORD --all-databases | gzip > /mnt/disk2/database_`data '+%m-%d-%Y'`.sql.gz
In the above command, 15 2 *** stands for the time when you want the backup to start. In this instance, it will run every day at 15:20.
The command will generate a compressed backup file every day named ‘database_MM_DD_YY.’ This will help you to organize the backup better. You can read more about command and how it works here.
3. Backup MySQL Database with phpMyAdmin
- Open phpMyAdmin from your hosting control panel.
- From the sidebar navigation panel of the phpMyAdmin, select Database.
- Click the Export link (top navigation bar).
- Select Custom option in the Export
- Select all the tables that you want to backup.
- Choose the gZipped option for Compression and leave the other options as it is.
- Click the Go button to download your MySQL database file to your computer.
This is a manual method of downloading your MySQL database file to your local drive for backup purposes.
You can back up the MySQL database automatically using tools like AutoMySQLBackup and Acronis Cyber Backup.
Alternatively, you can also create a cron job to perform the backups automatically on a VPS server.