原因:
这里先看下上面mysqldump的几个参数,
--opt Same as --add-drop-table,--add-locks, --create-options,
--quick,--extended-insert, --lock-tables,--set-charset,
and --disable-keys.Enabled by default, disable with
--skip-opt.
-f, --force Continue even if we get an SQL error.
其中,--opt里面包含了一堆的参数,这里最关键的是 --lock-tables,mysql5.6官方手册上的解释如下: --lock-tables, -l
For eachdumped database, lock all tables to be dumped before dumping them. The tablesare
lockedwith READ LOCAL to permit concurrent inserts in the case of MyISAM tables. For transactional
tables such as InnoDB,--single-transaction is a much better option than --lock-tables
because it does not need tolock the tables at all.
Because--lock-tables locks tables for each database separately, this option does notguarantee
that thetables in the dump file are logically consistent between databases. Tables indifferent
databasesmay be dumped in completely different states.
Someoptions, such as --opt, automatically enable --lock-tables. If you want tooverride this,
use--skip-lock-tables at the end of the option list.