3.5-mysql Backup and Recovery

Source: Internet
Author: User
Tags one table mysql backup mysql login

The system has MySQL Backup tool mysqldump


Backup MySQL format is similar to MySQL login, plus the backup library name. Remote backup and local backup available

mysqldump-uroot-phd792310 Discuz

Common mysqldump-uroot-phd792310 discuz >/data/discuz.sql

Note: Backup files are readable and can be cat-to-create TABLE statements and inserted content, such as: forum posts


Database tables for the forum under/data/mysql/discuz, each table has 3 different extension files

If you delete the Forum post table Rm-rf Pre_forum_post forum post will be an error.


Recovering a deleted database

mysql-uroot-phd792310 Discuz </data/discuz.sql Reverse redirect


You can also back up only one table in the database

mysqldump-uroot-phd792310 discuz pre_forum_post >/data/post.sql


Restore a table in the database

mysql-uroot-phd792310 Discuz </data/post.sql

Note: You need to add a table name when backing up, and you do not need to add a table name when recovering. Just with the library name .


If a character set is not specified at the time of backup, the database later changes the character set, which is garbled after recovery.

So the character set command is added to the backup

Mysqldump-uroot --default-character-set=gbk -phd792310 discuz pre_forum_post >/data/post.sql

When recovering, you also need to specify a character set, which avoids the problem of character set inconsistency

Mysql-uroot --DEFAULT-CHARACTER-SET=GBK -phd792310 discuz </data/post.sql

Common character sets have GBK UTF8 Latin where gbk and UTF8 support Chinese, and UTF8 supports more languages , recommended.


3.5-mysql Backup and Recovery

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.