9

Typecho支持utf8mb4编码

 3 years ago
source link: https://awsl.blog/2021/utf8_mb4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

参考链接 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
Shell

设置使用的数据库

use typecho;

输入上面的SQL语句。

Typecho站点配置文件修改

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

本篇文章采用 署名-非商业性使用 4.0 国际 (CC BY-NC 4.0) 许可协议进行许可。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK