Backup and Recovery for MySQL

Source: Internet
Author: User

Backup

# mysqldump -uroot-plam2linux discuz >/data/discuz.sql #备份discuz库, ending in *.sql

# Vim/data/discuz.sql #进入文件查看信息

If we delete the files in the Discuz library,

# RM-RF (filename)

Recovery

# MySQL -uroot-plam2linux discuz </data/discuz.sql #恢复discuz库内的信息

Not only can you back up the library but also back up the table (take the pre_forum_post table as an example)

Backup table

# mysqldump-uroot-plam2linux Discuz pre_forum_posT >/data/post.sql

Recovery table

# Mysql-uroot-plam2linux Discuz </data/post.sql

PS: Add a table name when backing up, and restore as long as the Discuz library name is enough

Special case:(Take pre_forum_post table for example)

the "character set" was not developed during backup, and the character set was inconsistent with the previous character set when recovering . the data that causes recovery is garbled,

Therefore, the backup should be Specify Character Set

Backup

# mysqldump-uroot--default-character-set=gbk-plam2linux discuz pre_forum_post >/data/post.sql

Recovery

# mysql -uroot--default-character-set=gbk-plam2linux Discuz </data/post.sql

Backup and Recovery for MySQL

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.