mysql 备份中的那些事儿
1. 默认备份是不会备份存储过程的, 所以如果你有存储过程需要备份,
1. 使用mysqldump备份数据库时, 会发现存储过程无法备份, 解决方法是加 -R 参数
/opt/mysql/bin/mysqldump -R -x --all-databases >all.sql
2. 全库备份:
/opt/mysql/bin/mysqldump -R -A -B -x >all.sql
mysqldump 说明:
--all Deprecated. Use --create-options instead.
-A, --all-databases Dump all the databases. This will be same as --databases
-B, --databases Dump several databases. Note the difference in usage; in
this case no tables are given. All name arguments are
regarded as database names. 'USE db_name;' will be
included in the output.
-x, --lock-all-tables
Locks all tables across all databases. This is achieved
by taking a global read lock for the duration of the
whole dump. Automatically turns --single-transaction and
--lock-tables off.
-R, --routines Dump stored routines (functions and procedures).