Use MySQL's own tool mysqldump for full-Library backups and source command recovery databases

Source: Internet
Author: User

MySQL database provides a very useful tool mysqldump to back up the database, the following will use the mysqldump command to back up all the databases and specify the database

One, mysqldump backup all database data at once

/usr/local/mysql/bin/mysqldump-u Username-p password--all-databases >/save path/file name. sql

Note: The above command can be entered directly in the console without logging into the database operator interface

Once the above command is executed, you can find your backup SQL file under the corresponding path.

Second, mysqldump one-time backup of the specified multiple database data

/usr/local/mysql/bin/mysqldump-u User name-p password--databases database 1 database 2 ... > Save path/file name. sql

Note: Databases backed up in these two ways will be backed up together with the database creation statement. Therefore, you do not need to create a database before restoring. There are some tools for remotely connecting databases,

Backup functionality is also provided, but backup of the SQL file does not necessarily back up the database creation statement, so when restoring, the database to be saved has already been created, otherwise it cannot be restored.

Third, restore the database using the source command

Using the source command, you need to log in to the database and invoke the command in the database operator interface to restore it, with the following syntax

Source path/file name. sql

The above is the process of using mysqldump for the whole library backup and restore

Use MySQL's own tool mysqldump for full-Library backups and source command recovery databases

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.