topleft topright

Tranquil Hosting Blog

Hsphere mysql backup script

Need to backup your mysql databases in a pinch? Here is a quick script for making backups of the mysql databases on a hsphere db server:


#!/bin/bash
#
#
TODAY=`date +%m-%d-%Y`
for i in $( ls -l /var/lib/mysql/ | grep drwx | awk '{print $9}' ); do
/hsphere/shared/bin/sudo -H -u mysql mysqldump -Q --opt -u root $i > $i.$TODAY.sql
done

It will put the database dumps in the directory where you run this script.

Leave a Reply

Copyright © 2007, Tranquil Hosting, Inc.
Managed Dedicated Servers | Managed Virtual Private Servers | Raleigh Datacenter Colocation
Raleigh, North Carolina Premium Hosting Provider
Terms of Service