Mysql Backup, Recovery

Source: Internet
Author: User
Tags mysql backup

Core tools: mysqldump

Local Backup table structure

Mysqldump-uroot-ppassword--no-data--databases database1 database2 database3> filename

Local BACKUP Database:

Mysqldump-uroot-ppassword databasename > FileName

Back up all databases locally

Mysqldump-uroot-ppassword--all-databases > FileName

Cross-server Backup (host2 first create an empty targedb):

Mysqldump--host=host1-uroot-ppassword--opt Sourcedb | MySQL--host=host2-uroot-ppassword-c targetdb

Database recovery:

MySQL DatabaseName < filename

Note Several parameters:

--add-drop-table generated backup file with drop table IF EXIST XXX Table

--skip-add-drop-table generated backup file will not have drop table IF EXIST XXX Table

--opt generated backup file with DROP TABLE ... With lock TABLES UNLOCK

-C Compressed Transport

Specific parameters can be mysqldump--help view

Recommendation: Backup files are a good habit to name a backup point in time

Mysql Backup, Recovery

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.