备份数据到同一实例下的其他数据库操作
会用到锁,其实也还好,没必要用到就尽量不要用。 #!/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....