User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

mysql_backup_locally [2009/05/02 07:11] (current)
k2patel created
Line 1: Line 1:
 +====== Mysql Backup Locally ======
 +<code bash |>​
 +DATE=$(date +%Y%m%d)
 +mysqldump=$(which mysqldump)
 +mysql=$(which mysql)
 +tar=$(which tar)
 +chown=$(which chown)
 +for i in $($mysql -p$PW -e "SHOW DATABASES"​|grep -v Database); do
 +        $mysqldump -p$PW --allow-keywords $i > $DIR/$i.sql
 +cd $DIR
 +$tar -cvf $DATE.tar *.sql
 +rm $DIR/*.sql
 +$chown -R $USER $DIR
 +exit 0
mysql_backup_locally.txt ยท Last modified: 2009/05/02 07:11 by k2patel