How to Automate MySQL Database Backups in Drupal 8 by Installing Modules?

How to Automate MySQL Database Backups in Drupal 8 by Installing Modules?

Backup is a must for any website. By having backup copies, you can retrieve your website in case there’s a breach or loss of data. To go a step further, you can automate the MySQL database backups for your Drupal 8 website. This requires you to install some modules like Backup & Migrate.

As an admin, you can create backup copies of entire website, copy of CMS outside of core, or solely of MySQL database. In this guide, find out how to automate the database backup in Drupal by using relevant modules.

Step by Step Process

Here are the steps you need to follow:
  • Install Backup & Migrate
Before anything else, you’d have to download the Backup & Migrate module. You can download the files by clicking here. Then install the modules to admin/modules/install. You can use FTP, Git, or Drush for this purpose.

If you’re installing manually, it’s recommended that you take your website offline. Once uploaded, get it back online. You can go maintenance mode by visiting - admin/config/development/maintenance
  • Configure the Settings
The next step is to configure the settings so the backup process proceeds correctly. For this purpose, navigate into this directory - admin/config/development/backup_migrate. Review the settings in every tab.

For the Quick Backup tab, you can change the settings for whether you want to manually download the MySQL database, the site file, the public directory, or the whole Drupal website.

Likewise for Advanced Backup tab has a wide range of settings you can tweak. Review each of the settings and make adjustments accordingly.
  • Create a Schedule for Backups
To automate the backup, you need to create a schedule for the Drupal system to follow. So open the Backup & Migrate module and navigate into the Schedule section. You can follow this directory - admin/config/development/backup_migrate/schedule.

Inside Schedule, click on “Add Schedule”. Enter a name for this schedule and review the site configuration.

For the backup source, select “Default Drupal Database”. And for backup destination, select “Private Files Directory”.

Finally, you need to choose between hourly or daily schedule. This is dependent on the traffic to your website and changes your website undergoes. Websites with high traffic and constant changes should opt for hourly backups.

In the Private Files Directory, experts insist on having somewhere between 10 to 100 database backups.

So that’s how you can automate your database backups. If your website gets hacked or goes offline, you can turn to the backup files and restore the website.

For this, you’d have to open the Public Files Directory and download the MySQL file, preferably the newest version. Then open the admin/config/development/backup_migrate/restore directory and upload the files you just downloaded. It will replace the current database and restore your website.
  • Working with phpMyAdmin and cPanel Tools
There are some backup & restore functionalities available in phpMyAdmin. Inside cPanel, you can open phpMyAdmin. Find the link for your Drupal 8 database and click on “Export”. This will create a copy of your database.

To export the database with UTF-8 standard, you need to navigate into Advanced Settings and make the changes.

Please bear in mind that the exports made through phpMyAdmin aren’t compatible with MySQL Database files created by Drupal 8 module. But you can use them for development, debugging, and security purposes.

For further assistance, get in touch with the customer support team.
Author
kumkumsharma
Views
165
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top