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