Use MySQLDumper to back up and restore Data

Source: Internet
Author: User

MySQL database itself provides the mysqldump command to back up data. Of course, we can also use other tools such as phpMysqlAdmin to back up the MySQL database. However, data corruption may occur when backing up a large amount of data. After all, http-based transmission has a certain error rate. I have not studied much, so it is difficult to draw conclusions or speculate here. I can only use commands that I can master to back up data. The prototype of the mysqldump command is as follows:

Mysql> mysqldump [options] db_name [tables] Back up a database or data table
Mysql> mysqldump [options] -- databases db1 [db2 db3 ..] Back up multiple databases
Mysql> mysqldump [options] -- all-databases back up all databases

When backing up a specific database or data table, we will use the First Command Option, specific to the database name or data table name. For example, you can use the following command to back up the test database: mysqldump-u root-p test> bak. SQL. To back up the test1 data table in the test database, run the following command: mysqldump-u root-p test. test1> test_test1bak. SQL.> You can follow any path you want to back up the output. Generally, the absolute path is used, which is convenient to process. For example, the output to the E disk is mysqldump-u root-p test> E: \ bak. SQL.

You can use the second Command Option to back up multiple databases. The -- databases option follows the name of the database to be backed up. For example, you can use the following command to back up wordpress and test databases: mysqldump-u root-p -- databases wordpress test> bak. SQL.

If you need to back up all the databases, you can use the third command. You only need to use the -- all-databases option.

"The sky is unpredictable, and everyone has a great fortune ". When the database crashes, don't be frustrated. In this case, we can restore the backup database to the previous data. The most important thing is that we can learn a lot from it. You can use the MySQL Command provided by mysql to restore the database, for example, mysql> mysql-u root-p <bak. SQL. Alternatively, you can recover to the new database mysql> mysql-u root-p newdatabase <bak. SQL.

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.