mysqldump命令中,与「DDL」有关选项

Usage scenarios for mysqldump include setting up an entire new MySQL

instance (including database tables), and replacing data inside an existing instance

with existing databases and tables. The following options let you specify which things

to tear down and set up when restoring a dump, by encoding various DDL statements

within the dump file.

· –add-drop-database

Write a DROP DATABASE statement before each CREATE DATABASE statement. This option

is typically used in conjunction with the –all-databases or –databases option

because no CREATE DATABASE statements are written unless one of those options is

specified.

· –add-drop-table

Write a DROP TABLE statement before each CREATE TABLE statement.

· –add-drop-trigger

Write a DROP TRIGGER statement before each CREATE TRIGGER statement.

· –all-tablespaces, -Y

Adds to a table dump all SQL statements needed to create any tablespaces used by

an NDB table. This information is not otherwise included in the output from

mysqldump. This option is currently relevant only to MySQL Cluster tables, which

are not supported in MySQL 5.7.

–no-create-db, -n
如果给出了–databases或–all-databases选项,使用该选项后不会输出CREATE DATABASE语句。

–no-create-info, -t
不要为每个dump的表输出CREATE TABLE语句。
注意:此选项不会从mysqldump的输出中排除创建「日志文件组」或「tablespace」的语句;但是可以使用–no-tablespaces选项来达到目的。

· –no-tablespaces, -y

This option suppresses all CREATE LOGFILE GROUP and CREATE TABLESPACE statements

in the output of mysqldump.

· –replace

Write REPLACE statements rather than INSERT statements.

参考文献