Linux backup database, mysqldump command example explanation

mysqldump mysql database backup tool is for MYSQL database server by way of a standard sql language of exported and saved to a file.

grammar:

mysqldump (option) 

Options:

--add-drop-table: add a statement to delete database data table before each create statement  
--add-locks: lock the database table when the backup database tables  
--all-databases: mysql backup of all databases on the server  
--comments : Add comment information  
--compact: compressed mode, produce fewer output  
--complete-insert: the insert statement output completion  
--databases: the database to be backed up  
--default-character-set: specify the default character set  
- force: when an error occurs still proceed with the backup  
--host: Specifies the backup server database  
--lock-tables: before making backup, lock all database tables  
--no-create-db: create database statement to disable the generation  
--no- create-info: disable the generation of database creation statements  
--pasword: connection password mysql server  
--port: port number mysql server  
--user: user name connected to mysql server 

Example:

Exporting the entire database

mysqldump -u username -p database name> exported file name 
mysqldump -u linuxde the Data -p> linuxde.sql

Export a table

mysqldump -u username -p database name watches> exported file name 
mysqldump -u -p the Data linuxde the Users> linuxde_users.sql

Exporting a database structure

-u -p -d --add_drop linuxde the mysqldump-Table smgp_apps_linuxde> linuxde_db.sql 
 -d no data, - add-drop-table Add a drop table before each create statement

The above is the Linux command mysqldump small series to introduce the example explanation, we want to help, if you have any questions please give me a message, Xiao Bian will promptly reply to everyone. In this I am also very grateful for the support of the home-site scripting!

Guess you like

Origin www.cnblogs.com/houss/p/12001187.html