How to Automate MySQL & MariaDB Backups on Jelastic PaaS
This guide explains how to create automated backup plans for MySQL and MariaDB databases on Jelastic PaaS, covering script configuration, cron scheduling, remote storage options, and restoring backups through phpMyAdmin, ensuring data safety and easy recovery.
In this article we explore how to create backups for MySQL and MariaDB databases, ensuring data can be restored when needed. The tutorial uses Jelastic PaaS’s built‑in backup script and shows how to set up automated cron jobs.
Data loss can occur due to human error, attacks, crashes, or disasters, so regular automated backups are essential. Jelastic provides a ready‑to‑use script that requires only a few parameters and a cron expression.
Setting Database Backup
The default backup script is located at /var/lib/jelastic/bin/backup_script.sh and can be viewed via the dashboard’s file manager.
To schedule the script, edit the cron file /var/spool/cron/mysql and add an entry in the format:
{frequency} {path to script} {script-parameters}Example parameters:
-m {mode} – dumpall or dump
-c {count} – number of old backups to keep
-u {user} -p {password} – database credentials (escape % with a backslash)
-d {databases} -t {tables} – specific databases or tables
For instance, to back up the entire database every 10 minutes:
*/10 * * * * /var/lib/jelastic/bin/backup_script.sh -m dumpall -c 3 -u root -p passw0rdSave the cron file to apply the schedule.
To store backups on another node or remote server, configure the appropriate installation node. Existing data in the node’s folder will be replaced by the remote files, or you can create a custom script that connects to a remote server.
After the script runs, backups appear as .bz2 archives in /var/lib/jelastic/backup.
Download Database Backup
You can retrieve backup files directly from the dashboard’s file manager, via SFTP/FISH, or by installing an FTP component (requires a public IP).
Restore Database from Backup
After creating a database node, access phpMyAdmin from the email notification. Use the “Import” tab, browse to the backup file, and upload it.
Upon successful import, phpMyAdmin shows a confirmation message, and the database is restored.
Following these steps ensures regular automated backups and easy restoration, keeping your data safe.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
