Create a backup of your MySQL databases. All in one file and/or one backup for each database.

To backup your databases you need a user who is allowed to read all data. I strongly recommend to create a new user only for the backup system instead of using roots account, because you have to save the users password in the script and if anybody is able to take a short look to it he’s able to own you database server! So create a new user, that must only have the following permissions:

CREATE USER 'mrsmith'@'localhost' IDENTIFIED BY 'mr.smiths.girlfriend';
GRANT SELECT, SHOW DATABASES, LOCK TABLES ON * . * TO 'mrsmith'@'localhost' IDENTIFIED BY 'mr.smiths.girlfriend';

Your new user is able to view all the necessary content, but not allowed to change anything!

Now you just have to edit the variables of the script to match your criteria and run it. If you like the results you should install a cronjob that creates periodically backups of you databases.

Download it directly from your terminal:

wget /wp-content/uploads/pipapo/scripts/mysqlbackup.sh
Download: Bash: mysqlbackup (Please take a look at the man-page. Browse bugs and feature requests.)