-F

同参数--flush-logs,在dump之前刷新日志,即生成一个新的二进制日志。一次dump多个库时,每个库都会刷新一次。但使用--master-data或--lock-all-tables只会刷新一次。

如下:

show master logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000022 | 120 |
+------------------+-----------+
mysqldump -uroot -p123456 -F -B bbp lmis > two_db.sql
show master logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000022 | 167 |
| mysql-bin.000023 | 167 |
| mysql-bin.000024 | 120 |
+------------------+-----------+
mysqldump -uroot -p123456 -F --master-data=2 -B bbp lmis > two_db.sql
show master logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000022 | 167 |
| mysql-bin.000023 | 167 |
| mysql-bin.000024 | 167 |
| mysql-bin.000025 | 120 |
+------------------+-----------+