Mysqldump command for MySQL database backup
Today, what the editor shares with you is the mysqldump command for MySQL database backup. I believe many people do not know much about it. In order to make you understand better, I summarized the following contents for you. Let's look down together. I'm sure you'll get something.
The mysqldump command is a backup tool in a MySQL database that is used to export a database in a MySQL server in a standard sql language and save it to a file.
Syntax format: mysqldump [parameters]
Common parameters:
-add-drop-table adds statements to delete database tables before each create database table statement-add-locks locks database tables when backing up database tables-all-databases backs up all databases on the MySQL server-comments adds comment information-compact compression mode Produce less output-complete-insert output completed insert statement-databases specifies the database to be backed up-default-character-set specifies the default character set-force continues the backup operation when an error occurs-host specifies the server to back up the database-before lock-tables backup Lock all database tables-no-create-db forbids the generation of database creation statements-no-create-info prohibits generation of database table creation statements-password for password connection to MySQL server-port number for portMySQL server-user name for user connection to MySQL server
Reference example
Export the entire database:
[root@linuxcool] # mysqldump-u linuxcool-p smgp_apps_linuxcool > linuxcool.sql
Export a table in the database:
[root@linuxcool] # mysqldump-u linuxcool-p smgp_apps_linuxcool users > linuxcool_users.sql
Export a database structure:
[root@linuxcool] # mysqldump-u linuxcool-p-d-- add-drop-table smgp_apps_linuxcool > linuxcool_db.sql the mysqldump command about MySQL database backup is shared here. I hope the above content can be used as a reference for everyone. If you like this article, you might as well share it for more people to see.