Board index SCRIPTS Backup

How to create a MySQL backup of all the database

Postby a24uall » Sun Jul 01, 2012 3:08 pm

Create a folder where you have to store the backup
mkdir /var/lib/mysqlbackup

You should be in that folder before the backup script is run
cd /var/lib/mysqlbackup


Now run

Code: Select all
for db in `echo 'show databases;' | mysql -u root --password='H00AOoE' | grep -v ^Database ` ; do mysqldump --opt $db | gzip > $db.sql.gz ; done

OR
Code: Select all
for db in `echo 'show databases;' | mysql | grep -v ^Database ` ; do mysqldump --opt $db | gzip > $db.sql.gz ; done
Arun
WebhostingDevelopment.com
a24uall
Site Admin
 
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Return to Backup

Who is online

Users browsing this forum: No registered users and 1 guest


cron