mysqldump -h 'xxxx' -uroot -p'xxxx' -R -B -A --single-transaction |gzip > /mysql/mes_$(date +%Y%m%d_%H%M%S).sql.gz
/usr/bin/find /mysql_bak/ -mtime +7 -exec rm -rf {} \;
-R routines
contains CREATE PROCEDURE
and CREATE FUNCTION
statements
-A --all-databases
-B --databases CREATE DATABASE
and USE
statements are included in the output before each new database.
This option may be used to dump the INFORMATION_SCHEMA
and performance_schema
databases, which normally are not dumped even with the --all-databases
option.
--single-transaction 不锁库 快照备份