This article covers steps only for MySQL database backup via Plesk.
Plesk in Linux does not provide the option to generate backups for MySQL databases via Backup Manager. The only way to get a backup is to use the export option via phpMyAdmin. Click here for details.
The only way to automate the backup process is to configure a CRON for the following script.
Tip
You will have to manually create a /mysqlbackup directory on your server before executing the script.
As per the script, the backup will be created under the /mysqlbackup directory and the name of the backup will be as db-dbName-yyyymmdd.dump.gz. Upon execution, the script will check for old backups and delete them automatically depending upon the value of mtime you want to specify in the script.
#!/bin/bash
# Set the datestamp, login credentials, and backup directory
export date=$(date +\%Y\%m\%d)
export creds="-uadmin -p`cat /etc/psa/.psa.shadow`"
export backupdir="/mysqlbackup"
# delete week old files
find ${backupdir}/ -regex '.*.dump.gz' -mtime +4 -exec rm {} \;
# dump databases to the backupdir
echo "show databases;" | mysql ${creds} | egrep -v ^Database$ | \
awk '{print "mysqldump ${creds} "$1" | \
gzip > ${backupdir}/db-"$1"-${date}.dump.gz"}' | \
sh