BACKUP ALL DATABASES:
#!/bin/sh
#
# SCRIPT TO DUMP ALL THE DATABASES
#
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/lib:/etc
export PATH
/usr/bin/mysqldump -u root --password=<your mysql root password> --all-databases | gzip > /root/mysqlbackup/databasebackup.sql.gz
RESTORE ALL DATABASES:
/usr/bin/mysql -u root -p < databasebackup.sql.gz
enter your root password when prompted