Backup all databases on a plesk server

This is not the fastest not the safest and not the most eficient, but it does work. and unless you have a realy bussy database this is a pretty oke way to backup your database. It uses mysqldump and the internal plesk credentials so no need to type passwords at all. It can ofcourse be used on any other mysql server as long as you set the right credentials. #! /bin/bash # aapjeisbaas.

Copy mysql database to dev location

![db copy] ({filename}/static/images/db_copy.jpg) If you are just here for the script copy the script and have fun. If you want a bit more info read on this script is tweakable to some extend. #! /bin/bash TIMESTAMP=$(date +"%F") BACKUP_DIR="/tmp/db-dump/$TIMESTAMP" MYSQL_USER="root" MYSQL=/usr/bin/mysql MYSQL_PASSWORD="password" MYSQLDUMP=/usr/bin/mysqldump mkdir -p "$BACKUP_DIR" databases="live_db" for db in $databases; do test_db=$db"_test" $MYSQLDUMP --user=$MYSQL_USER -p$MYSQL_PASSWORD $db | gzip > "$BACKUP_DIR/$db.sql.gz" mysql --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "DROP DATABASE IF EXISTS $test_db;" mysql --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE $test_db;" zcat "$BACKUP_DIR/$db.