Discuz new installation and upgrade, import old data process, by the way gbk to utf8

Since the official discuz has not been updated, and now there is only a ready-made utf8 version, there is no gbk version. We originally used gbk encoding. Recently, we want to change the version. By the way, we can upgrade it. Just replace gbk with utf8, so that it will be convenient and internationalized in the future!

 

The first step: freshly install the utf8 version of discuz 3.4, select ucenter non-independent during installation, unless you do not want to upgrade ucenter. However, it seems that ucenter has not been updated. Whether you want to install it independently or not is up to you. I'm a clean freak, I want to install the purest one, and I can peel it off later.

Step 2: Export the original data and specify it as utf8 encoding for export. The table structure and data should be exported separately. If the amount of data is not large, export it directly with client tools such as phpmyadmin. If the amount of data is large, it is recommended to use the command line. Execute statement:

Export structure:

mysqldump -d -u root -p database name>/directory/struct.sql

export data:

mysqldump --default-character-set=utf8 -t -u root -p database name>/directory/data.sql

Step 3: Modify the default encoding of the table structure struct.sql, and use the text tool to batch replace "gbk" with "utf8".

Step 4: Create a new library, import the exported sql with utf8 encoding, and also decide whether to use the command line depending on the amount of data, otherwise, if the data is large, the import will time out. Entering into mysql and executing the import statement is:

source/directory/struct.sql;
source/directory/data.sql;

Step 5: Modify the configuration of config/config_global.php, config_ucenter.php and uc_server/data/config.php.

Step 6: Enter the discuz management center, update the cache, and you're done!

 

Special reminder: Since my original version is discuz3.2 and I upgraded to discuz3.4, some tables in the database still have some changes. You can use the comparison tool to compare the table structure of the two versions, and the corresponding table structure in the original table structure. add field. If it is the same version conversion, it can be ignored.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324937491&siteId=291194637