1.同实例拷贝数据库
shell> mysqldump db1 > dump.sql
shell> mysqladmin create db2
shell> mysql db2 < dump.sql
2. 数据库迁移
On Server 1:
shell> mysqldump --databases db1 > dump.sql
Copy the dump file from Server 1 to Server 2.
On Server 2:
shell> mysql < dump.sql
3. Dumping Stored Programs
Several options control how mysqldump handles stored programs (stored procedures and functions,
triggers, and events):
• --events: Dump Event Scheduler events
• --routines: Dump stored procedures and functions
• --triggers: Dump triggers for tables
The --triggers option is enabled by default so that when tables are dumped, they are accompanied
by any triggers they have. The other options are disabled by default and must be specified explicitly to
dump the corresponding objects. To disable any of these options explicitly, use its skip form: --skipevents,
–skip-routines, or --skip-triggers.
4.dump表结构或者数据
The --no-data option tells mysqldump not to dump table data, resulting in the dump file containing
only statements to create the tables. Conversely,