修改数据库 charset 为 utf8mb4

数据库执行:

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;

修改 Typecho 配置文件 config.inc.php 中数据库定义参数中的 charset 为 utf8mb4

$db->addServer(array (
  'host'      =>  'localhost',
  'user'      =>  'root',
  'password'  =>  'password',
  'charset'   =>  'utf8mb4', //修改这一行
  'port'      =>  3306,
  'database'  =>  'dbname'
), Typecho_Db::READ | Typecho_Db::WRITE);
Typecho_Db::set($db);
Last modification:June 27, 2020
如果觉得我的文章对你有用,请随意赞赏