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.