Scheduling MySQL/MariaDB Backups

Using this instruction you can easily schedule the automatic backup of a MySQL or MariaDB database.

Setting up backups

Click Config button next to your database.

configure database

In the opened configuration tab open mysql file in the cron folder.

In the opened file you’ll see three samples of the cron parameters configurations:

for backup of several DBs (if you created them through the db admin panel):

#0 1 * * * /var/lib/jelastic/bin/ -m dump -u USER -p PASSWORD -d db1[,db2,db3….]

for separate DB tables backup:

#0 2 * * * /var/lib/jelastic/bin/ -m dump -u USER -p PASSWORD -d db -t table1[,table2,table3….]

for the whole DB backup:

#0 3 * * * /var/lib/jelastic/bin/ -m dumpall -u USER -p PASSWORD

Choose the one you need and specify your custom configurations:

  • frequency of the script evoking (using cron settings);
  • the path to the default script (available for MariaDB and MySQL) or to your own (you can upload it to the scripts folder): /var/lib/jelastic/bin/{script_name}
  • your database username and password (you received them in the email after adding database to the environment);
  • if you want to backup several databases or some separate tables, then enter their names separated by commas.

For example, if you want to backup your database every 10 minutes with a help of the default script, then the string can be as following:

*/10 * * * * /var/lib/jelastic/bin/ -m dumpall -u root -p GGddHYJ

Save your settings!

Checking backups

Wait the time of backup you’ve scheduled while setting.

Navigate to Configuration tab and open backup folder (/var/lib/jelastic/backup). There .bz2 files with all executed backups are stored.

checking backups

Download Backup

Install FTP for your database. You can find instructions here.

download backups

Connect to the MySQL/MariaDB database using any FTP client (e.g. FileZilla) and download your backup .bz2 file.

ftp client

Restore Database

Access phpMyAdmin with the credentials you’ve got after adding DB node.

Navigate to the Import tab and browse the backup .bz2 file. Click Go.


When the import is successfully finished you will see your database with all the data restored.


Now you can be sure that all your data is being saved periodically and can be restored or reused.

in Jelastic



Related Articles

Leave a Reply