Is there an easy way to backup all of the MySQL databases for all accounts on the server. I am going to upgrade from 4.0.x to 4.1.x and need to backup all of the dbs before doing so.
You might also want to create a tar.gz file for each database, as opposed to huge archive.
You can use the following bash script to accomplish this:
Code:
#!/bin/bash
## Specify the directory for these backups, be sure to make sure it exists.
BACKUPDIR="/backup/sql"
clear
echo -n "Creating archives on a per database basis..."
for i in `ls /var/lib/mysql`
do
tar -czf $BACKUPDIR/$i.tar.gz $i
echo -n "."
done
echo -n "Process complete."
exit 0