Mysqldump Backup recovery database

Source: Internet
Author: User
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:

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.