MySQL Backup and restore

Source: Internet
Author: User

MYSQLL provides a mysqldump command that we can use to back up data.

Follow the prompts to enter the password, this will be the ABC database all the table structure and data back to Abc_20161108.sql,

# mysqldump-u ROOT-P ABC > Abc_20161108.sql


Because you want to always do backup work, if the data volume conference occupies a lot of space, then you can use gzip to compress the data, the command is as follows:

# mysqldump-u root-p TABC m | gzip > abc_20161108.sql.gz

The system crashes, and when you rebuild the system, you can recover data like this:

# mysqldump-u ROOT-P ABC < Abc_20161108.sql

To restore directly from a compressed file:

#gzip < abc_20161108.sql.gz | Mysqldump-u root-p ABC

Of course, there are a lot of MySQL tools to provide more intuitive backup recovery, such as the use of phpMyAdmin is very convenient.
But I think that mysqldump is the most basic and most universal.

As an automated GUI or interface test that generates data such as registration, you can use a script to back up the database before the test executes, perform a restore after each test, and delete the backup.

If the data confirmation will be persistent, you can remove the last step of deleting the backup.

MySQL Backup and restore

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.