Documentation for mysqldump: http://dev.mysql.com/doc/refman/5.1/zh/client-side-scripts.html#mysqldump
Mysqldump
It is most commonly used to back up an entire database:
shell> mysqldump db_name >backup-file.sql
You can read the dump file back to the server as follows:
Shell>MySQLDb_name<Backup-file. SQL
Correspondingly, the command to import data to the target server is:
Shell>Mysqladmin create target_db_name
Shell>MySQL target_db_name <backup-file. SQLThe following example dumps the replication_test database to the D:/replication_test. SQL file and adds drop table if exists to the generated SQL statement.
Mysqldump-u root-proot -- add-drop-database -- add-drop-Table replication_test> D:/replication_test. SQL
The following are some common simple usage methods:
1. Export the entire database
Mysqldump-u username-P Database Name> exported file name
2. Export a table
Mysqldump-u user name-P database name Table Name> exported file name
3. Export a database structure
Mysqldump--U username-P database name -- no-Data-- Add-drop-database -- add-drop-tableSmgp_cmd_wcnc> D:/wcnc_db. SQL
-- No-data: no dump database, -- add-drop-database add a drop database before creating the database -- add-drop-table add a drop table before each create statement