PostgreSQL and MySQL - automate the backup process with autopostgresqlbackup and automysqlbackup

PostgreSQL and MySQL - automate the backup process with autopostgresqlbackup and automysqlbackup

Posted: 10 years ago in  Unix | Database | MySQL | PostgreSQL |


Database is a matter of system. Day by day, it grows up and become more important. Even when we do not change the running system, it is a good habit to backup regularly databases. It would help you ensure the Recover Time in SLA to client, just in case.


Database is a matter of system. Day by day, it grows up and become more important. Even when we do not change the running system, it is a good habit to backup regularly databases. It would help you ensure the Recover Time in SLA to client, just in case.

Autopostgresqlbackup and Automysqlbackup have simple features as pg_dump and mysqldump. However, it is more advance when making incremental backups by every day, week and month, instead we have to do it manually.

Here is the installation and configuration on Debian.

Install package

sudo apt-get install autopostgresqlbackup
sudo apt-get install automysqlbackup

Run script once
Run it with su permission because it have to create folder autopostgresqlbackup and automysqlbackup in /var/lib/

sudo autopostgresqlbackup
sudo automysqlbackup

After run the command, you have the backups in /var/lib/autopostgresqlbackup or /var/lib/automysqlbackup, organized by daily/weekly/monthly folders then databasename folder

cd /var/lib/autopostgresqlbackup/
cd /var/lib/autopostgresqlbackup/

Do advance configuration
If you need to configure parameters such as host, restricted databases to backup, compression type, etc..., autopostgresqlbackup and automysqlbackup file in /etc/default/ is what you are looking for

sudo nano /etc/default/autopostgresqlbackup
sudo nano /etc/default/automysqlbackup

Enjoy.