1. mysqldump-A database backup program
Mysqldump [Options] [db_name [tbl_name...]
If you do not specify any tables, the entire database will be exported.
2. Option [2]
-- Opt optimizes the table's dump speed and writes the dump file, which is the best reload speed. This option enables-add-drop-table, -- add-locks, -- all -- extended-insert, -- quick, and -- lock-tables.
3. Example
1) Export the database
①Export the table structure whose database is dbname (the username is root, the password is dbpasswd, And the generated Script Name Is dB. SQL)
Mysqldump-u root-P dbpasswd-D dbname> dB. SQL;
②The exported database is a dbname table (TEST) structure.
Mysqldump-u root-P dbpasswd-D dbname test> dB. SQL;
③Export all table structures and table data (without-d) in the database as dbname)
Mysqldump-u root-P dbpasswd dbname> dB. SQL;
④Export Database to dbname a table (TEST) structure and table data (without-d)
Mysqldump-u root-P dbpasswd dbname test> dB. SQL;
⑤Export with language Parameters
Mysqldump-uroot-p -- default-character-set = Latin1 -- Set-charset = GBK -- skip-opt Databse> dB. SQL
2) import the database
①Shell> mysqladmin create target_db_name
Shell> MySQL target_db_name <backup-file. SQL
②Mysqldump-H localhost-u root-PDbpasswd dbname>Dbname_bak. SQL
③Use my_db // the database to be exported
Source/var/mysqldata/mysql2007. SQL // execute Import
Reference
[1]Http://linux.die.net/man/1/mysqldump
[2] Translation of options
Http://www.blogjava.net/Alpha/archive/2007/08/10/135694.html
[3]Http://www.cnblogs.com/yuanyouqi/archive/2010/04/28/1722738.html
[4] detailed introduction to Database Backup
Http://hi.baidu.com/li_shen/blog/item/a85646235e7f9041ac34de4e.html
Http://www.haogongju.net/art/699827