Mysqldump can be used to back up and restore databases. By default, mysqldump creates droptable, createtable, and insertinto SQL statements.
Mysqldump can be used to back up and restore databases. By default, mysqldump creates drop table, create table, and insert into SQL statements.
Mysqldump can be used to back up and restore databases. By default, mysqldump creates drop table, create table, and insert into SQL statements.
Syntax
> Mysqldump [options] db_name [tbl_name...]
> Mysqldump [options] -- databases db_name...
> Mysqldump [options] -- all-databases
Back up a specified database
Mysqldump-uroot-p [passwd] db1> dumpfilename. SQL
Back up multiple databases
Mysqldump-uroot-p [passwd] -- databases db1 db2> dumpfilename. SQL
Back up all databases
Mysqldump-uroot-p [passwd] -- all-databases> dumpfile. SQL
Backup specified table
Mysqldump-uroot-p [passwd] db1 table1> db1_table1. SQL
Back up only the table structure
Mysqldump-uroot-p [passwd]-d db1> dumpfile. SQL
If you do not want to drop table, attach the parameter -- compact.
Mysqldump-uroot-p [passwd] -- compact db1> dumpfile. SQL
Restore
Mysql-uroot-ppassword db1 <dumpfile. SQL
If the storage engine is MYISAM, you can also use mysqlhotcopy
Mysqlhotcopy-u root-p passwd db1 Backup Directory
Note:-u is followed by a space. mysqlhotcopy is equivalent to copying database files to a new directory. The restoration method is to copy the Backup Directory to the mysql data directory.
Use mysqldump to back up MariaDB
Use mysqldump to export a database
Quickly build a slave Database Based on mysqldump
Restore the backup set created by mysqldump
Use mysqldump command line tool to create logical backup
This article permanently updates the link address:
,