Go Summary of common commands for MySQL database backup and restore

Source: Internet
Author: User

MySQL database backup and restore of common command summary, learning MySQL friends can refer to the following:

Commands to back up the MySQL database

- - - > backupfile.sql

backing up the MySQL database to a format with a delete table backing up the MySQL database is a format with a delete table that allows the backup to overwrite the existing database without having to manually delete the existing database.

-- -add-drop-table-uusername-ppassword databasename > Backupfile.sql

Compress the MySQL database directly backup

- - - | > backupfile.sql.gz

Back up a MySQL database (some) table

- - - > backupfile.sql

Back up multiple MySQL databases at the same time

- - - -- databases databasename1 databasename2 databasename3 > Multibackupfile.sql

Backing up the database structure only

-- no-data--databases databasename1 databasename2 databasename3 > Structurebackupfile.sql

Back up all databases on the server

-- all-databases  Allbackupfile.sql

Commands to restore MySQL database

- - - < Backupfile.sql

Restore a compacted MySQL database

< | - -ppassword databasename

To transfer a database to a new server

mysqldump \-uusername \-ppassword databasename \| mysql \--host=*.* . *.\* \-c DatabaseName

Compress backup

Backup and compress with gzip:
< mysqldump options>| > outputfile.sql.gz

Restore from gzip Backup:

< | < mysql options>

Backup and compress with bZIP:

< mysqldump options>| > outputfile.sql.bz2

Restore from bzip2 Backup:

< | < mysql options>

Go Summary of common commands for MySQL database backup and restore

Related Article

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.