Created
July 6, 2014 18:03
-
-
Save DrayChou/9e342b6c5d63fe0bb209 to your computer and use it in GitHub Desktop.
导出数据表为XML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
username="" | |
passwd="" | |
host="" | |
db1="" | |
#连接数据库把表都拉出来 | |
mysql_tables=`mysql -h $host -u $username -p"$passwd" -e "use $db1; show tables; " | grep -vE "Tables_in_src_master"` | |
#循环把表导出为XML | |
for i in ${mysql_tables[@]} ; do | |
#导出数据表 | |
mysqldump --xml -h $host -u $username -p"$passwd" $db1 $i | tee $db1.$i.xml | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment