To backup every database on a server, you can use this script:
#!/bin/bashUSER=rootMYSQLCMD=/usr/bin/mysqlMYSQLDUMP=/usr/bin/mysqldump
BACKUPPATH=/BACKUPS/MYSQL
$MYSQLCMD -e -u
$USER -p "show databases" | awk '{ print $1 }' | grep -v ^Database$ |
while read DBdo$MYSQLDUMP -u $USER -p $DB >
$BACKUPPATH/$DBdone
This connects to your local MySQL server as $USER, prompts for a
password, and backs up every database to a correspondingly named .sql file
under the directory $BACKUPPATH.