民审-M

GBK编码网站转UTF-8编码手工转码参考教程

作者:民审-M   发布时间:2018-12-11 21:05   回复数:0   浏览数:22
民审-M
220民审-M金牌草根
2018-12-11 21:05:11
220 2018-12-11 21:05:11
话题: GBK 编码 网站 UTF
[font=&quot]1、安装与GBK版本一致的UTF-8版本的DISCUZ,表前缀保持一致
[color=rgb(51, 51, 51)][font=&quot]2、登录GBK版本后台,数据维护,强制字符集选择UTF-8,然后备份数据

[color=rgb(51, 51, 51)][font=&quot]3、将备份好的数据导入到新的UTF-8数据库,并登录后台测试是否有问题

[color=rgb(51, 51, 51)][font=&quot]4、如果没有问题,转移上传的图片文件至UTF-8站点,并把域名绑定到UTF-8站点所在目录

[color=rgb(51, 51, 51)][font=&quot][color=rgb(255, 0, 0)]如果数据量太大导致后台备份或导入失败,可以使用以下命令(仅参考,库名等以实际名称为准)方式备份和导入:

[color=rgb(51, 51, 51)][font=&quot]1、导出GBK数据库表结构

[color=rgb(51, 51, 51)][font=&quot]1.1 Windows服务器
[color=rgb(51, 51, 51)][font=&quot]运行cmd
[color=rgb(51, 51, 51)][font=&quot]D:
[color=rgb(51, 51, 51)][font=&quot]cd D:\DTServer\mysql\bin
[color=rgb(51, 51, 51)][font=&quot]mysqldump --default-character-set=utf8 -d -uroot -p123456 destoongbk > D:\destoon-d.sql

[color=rgb(51, 51, 51)][font=&quot]1.2 Linux服务器
[color=rgb(51, 51, 51)][font=&quot]mysqldump --default-character-set=utf8 -d -uroot -p123456 destoongbk > /www/destoon-d.sql

[color=rgb(51, 51, 51)][font=&quot]2、替换字符

[color=rgb(51, 51, 51)][font=&quot]2.1 Windows服务器
[color=rgb(51, 51, 51)][font=&quot]Editplus等软件打开D:\destoon-d.sql,查找CHARSET=gbk替换为CHARSET=utf8

[color=rgb(51, 51, 51)][font=&quot]2.2 Linux服务器
[color=rgb(51, 51, 51)][font=&quot]sed -i s/CHARSET=gbk/CHARSET=utf8/g `grep -rl "CHARSET=gbk" /www/destoon-d.sql`

[color=rgb(51, 51, 51)][font=&quot]3、导出GBK数据

[color=rgb(51, 51, 51)][font=&quot]3.1 Windows服务器
[color=rgb(51, 51, 51)][font=&quot]mysqldump --default-character-set=utf8 -t -uroot -p123456 destoongbk > D:\destoon-t.sql

[color=rgb(51, 51, 51)][font=&quot]3.2 Linux服务器
[color=rgb(51, 51, 51)][font=&quot]mysqldump --default-character-set=utf8 -t -uroot -p123456 destoongbk > /www/destoon-t.sql

[color=rgb(51, 51, 51)][font=&quot]4、导入结构和数据

[color=rgb(51, 51, 51)][font=&quot]4.1 Windows服务器
[color=rgb(51, 51, 51)][font=&quot]mysql -u root -p123456 destoonutf8 < D:\destoon-d.sql
[color=rgb(51, 51, 51)][font=&quot]mysql -u root -p123456 destoonutf8 < D:\destoon-t.sql

[color=rgb(51, 51, 51)][font=&quot]4.2 Linux服务器
[color=rgb(51, 51, 51)][font=&quot]mysql -uroot -p123456 destoonutf8 < /www/destoon-d.sql
[color=rgb(51, 51, 51)][font=&quot]mysql -uroot -p123456 destoonutf8 < /www/destoon-t.sql

[color=rgb(51, 51, 51)][font=&quot]注意:是导入到UTF-8数据库里,并且要按文件顺序导入

[color=rgb(51, 51, 51)][font=&quot]参考:
[color=rgb(51, 51, 51)][font=&quot][font=&quot]请问,整站怎么转码(见2楼)
[font=&quot]https://www.cgzz8.cn/t-32702-1-1.html
[font=&quot](出处: 草根吧)

游客
登录后才可以回帖,登录 或者 注册