After I switched to wordpress, the first consideration was its database backup and recovery problem, because bloger knows that all of its blog records are valuable materials and texts that they need, if the database crashes or the Space Provider encounters a problem due to unknown factors and data is lost, it will be a great deal of pain and loss.
So I have several articles in my blog or my own articles to discuss mysql Database Backup Recovery and garbled characters.
The results discussed in previous articles have already met my database backup and recovery problems for the time being, but there is always something I cannot feel at ease about, that is, when PMA is used for recovery, the upload mechanism is used. By default, PHP is the maximum upload capacity of 2 MB. If I continue writing my blog and write it for a few years, the data backed up exceeds 2 MB, what should I do?
I thought of this problem again when I was sunning this afternoon, but I suddenly remembered that I could choose to back up the table when I backed up the data? In fact, I can store tables one by one and restore tables one by one. This is equivalent to dividing a compressed package into several copies, thus reducing the volume of each copy. Oh, I feel more comfortable. However, the problem is that wp logs are stored in the wp_posts table. Even other tables such as options and comments are a small part. What if the posts Table has more than 2 MB of data?
I don't know if I am worried. The 2 MB gzip file can save more than N logs. As the saying goes, if you are in danger, you can be prepared and prepared! Then I thought about it again. If I do not want to save it as gzip, I will save the txt file of the SQL statement. When I restore it, please copy and paste the SQL code manually, although it is a little troublesome, there is no problem in restoring it. Haha. I think of it again. You do not have to worry about the backup and recovery problems after the database grows. : 0
In fact, if I want to focus on my research and write code, I can write a program for wp database backup and recovery. Unfortunately, I just want to be lazy with wp, I used its huge resources to facilitate myself. Because I was too busy with work, if I spent time developing it, I thought I could not devote myself to my work...
Of course, unless it is my blog that has been written for too long, the data size is too large, and it is all valuable information, I would like to continue with this requirement, I should write a complete wp database backup and recovery program myself.
Finally, I would like to add a solution to the problem of garbled mysql databases. The materials come from a user in a QQ group of wp:
Finally solved the wordpress Chinese garbled Problem
Based on the methods of many people, I finally confirmed it. The summary is as follows:
1. Mysql Processing
(1) Configuration File Processing
Delete default-character-set = latin1 in My. ini
(Some people like to change it to default-character-set = utf8. That's fine. I just deleted it. Just pay attention to the "sorting" in section 2 below !)
(2) PhpMyadmin Processing
The settings are as follows:
1: Language set to chinese (zh-utf-8)
2. MySQL Character Set: UTF-8 Unicode (utf8)
3: MySQL connection verification: utf8generalci
4: when adding databases and data tables, select utf8generalci as the sorting item.
2. Wordpress Processing
In $ this-> dbh = @ mysqlconnect ($ dbhost, $ dbuser, $ dbpassword ); |
Next, add a sentence
$this->query(”set names ‘utf8’”); |
That is, the following (only after this sentence is added, the text in the post is normal !) :
$this->dbh = @mysqlconnect($dbhost, $dbuser, $dbpassword);$this->query(”set names ‘utf8’”); |