cat > dump_sql.sh <<'EOF'
echo "CREATE DATABASE IF NOT EXISTS \`$1\` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" > $1.sql
echo "use $1;" >> $1.sql
mysqldump -uroot -p123456 $1 >> $1.sql
EOF
chmod +x dump_sql.sh
复制粘贴生成dump_sql.sh, 参数为数据库名, 根据需要修改数据库密码