How to Use mysqldump to back up and restore a specified table

Source: Internet
Author: User
How to Use mysqldump to back up and restore a specified table

How to Use mysqldump to back up and restore a specified table


The Code is as follows:
Mysqldump-u user-p db tab1 tab2> db. SQL


Restore
The Code is as follows:
Mysql-u user-p db <db. SQL


Refer:

1. copy backup files: (ensure that the database has no write operations (you can lock the Table). Copying files directly cannot be transplanted to other machines, unless the table you are copying uses the MyISAM storage format.
2. mysqldump: mysqldump generates text files that can be transplanted to other machines

Example:
Back up the entire database --> mysqldump db1>/backup/db1.20060725
Compressed backup --> mysqldump db1 | gzip>/backup/db1.20060725
Table sharding backup --> mysqldump db1 tab1 tab2>/backup/db1_tab1_tab2. SQL
Direct remote backup --> mysqladmin-h boa.snke.net create db1
--> Mysqldump db1 | mysql-h boa.snke.net db1

Copy the backup table --> cp tab. * backup/


Restore
Use the latest backup file to reinstall the database. If you use the file generated by mysqldump, use it as the mysql input. If you copy files directly from the database, copy them directly back to the database directory. However, you need to close the database before copying the files, and then restart it.

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.