Skip to content

Instantly share code, notes, and snippets.

@kevinbin
Created November 17, 2012 07:21
Show Gist options
  • Save kevinbin/4093997 to your computer and use it in GitHub Desktop.
Save kevinbin/4093997 to your computer and use it in GitHub Desktop.
mysql逻辑备份单表文件
user=""
passwd=""
dbname=""
for table in `mysql -u$user -p$passwd $dbname -BNe 'show tables'; do
mysqldump -u$user -p$passwd --single-transaction $dbname $table |gzip > $table.sql.gz
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment