Tuesday, January 18, 2011

Mysql and Postgresql Backup and Restore method

Mysql and Postgresql Backup and Restore method
 
#Backup for Mysql DB
tar jcvf db.tar.bz2 /var/lib/mysql
 
#Restore
tar -C /var/lib/mysql -jxvf db.tar.bz2
 
#backup for Postgresql Database
/usr/bin/pg_dumpall > /home/baskar/backup/db.out
 
#Restore
psql -e -d template1 -f /home/baskar/backup/db.out

1 comment: