批量导出mysql数据库脚本

#!/bin/bash
 
user=""
passwd=""
host=""
 
mysqldata=`mysql -h$host -u$user -p$passwd -e "show databases"|grep -vE "mysql|information_schema|performance_schema|Database|discuz_new"`
echo $mysqldata
 
for i in ${mysqldata[@]} ; do
 
mysqldump -h$host -u$user -p$passwd --single-transaction --set-gtid-purged=OFF --quick --databases $i > $i.sql
 
done

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • ➡
  • 😕
  • ❓
  • ❗
  • 67 queries in 0.410 seconds