会用到锁,其实也还好,没必要用到就尽量不要用。 #!/bin/sh mysql -uroot -p8rKSwodBFkcteU8h 2>/dev/null -e "flush tables with read lock;" mysql -uroot -p8rKSwodBFkcteU8h 2>/dev/null -e "create database bolo_bak;" tbname=(mysql -uroot -p8rKSwodBFkcteU8h 2>/dev/null -e "SELECT table_name from information_schema.tables where TABLE_SCHEMA='bolo'") for i in tbname; do mysql -uroot -p8rKSwodBFkcteU8h bolo_bak 2>/dev/null -e "create table i like bolo.i" mysql -uroot -p8rKSwodBFkcteU8h hellodb_bak 2>/dev/nu....... 备份数据到同一实例下的其他数据库操作 mysql