Mysql backup and recovery methods

Source: Internet
Author: User
Tags mysql backup

 

Mysqldump

Back up the entire database

Mysqldump-u root-ppassword databasename> data. SQL

// Enter the root password.

Back up one or more tables

Mysqldump-u root-p databasename table1name table2name> data. SQL

// Enter the root password.

Back up data structures only

Mysqldump-u root-p databasename-no-data> data. SQL

// Enter the root password.

Restore

Mysql-u root-p-database = databasename

// Enter the root password.

 

Backup:

/Usr/local/mysql/bin/mysqldump-add-drop-table-all-databases-opt-f-uroot-pabc>/back/mysql-back. SQL/whole database

Tar czvf/back/mysql-back.tgz/back/mysql-back. SQL

 

/Usr/local/mysql/bin/mysqldump-add-drop-table-opt-f-uroot-p123 ywrc>/home/back/www/ywrc. SQL // single database

Tar czvf/home/back/www/tar/ywrc-back.tgz/home/back/www/ywrc. SQL

 

Recovery:

Mysql ywrc <ywrc. SQL

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.