menu Thinking Null
more_vert
Typecho支持utf8mb4编码
2021-02-06 | typecho维护 | 暂无评论 | 316 次阅读 | 131字

参考链接 https://www.jianshu.com/p/3e4c437582e1
https://blog.zt2qmq.top/archives/241/

数据库修改

检查字符集的语句

SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';

修改数据库字符集编码(可选)

alter database typecho character set utf8mb4 collate utf8mb4_unicode_ci;

修改表字符集编码(必做)

输入修改字符集编码的语句

alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_unicode_ci;

装过Links插件的多执行这条

alter table typecho_links convert to character set utf8mb4 collate utf8mb4_unicode_ci;

装过Access统计访客流量插件的,多执行这条

alter table typecho_access_log convert to character set utf8mb4 collate utf8mb4_

修改方式

使用主机bash

登录数据库

mysql -u root -p 114514

设置使用的数据库

use typecho;

输入上面的SQL语句。

Typecho站点配置文件修改

把站点根目录下config.inc.php中的 'charset' => 'utf8', 修改为 'charset' => 'utf8mb4' 就大功告成了 ??

发表评论
暂无评论
textsms
account_circle
email
link