Preface
正处于魔改当中,恰巧发现了下面这篇文章,把前因后果都讲清楚了:
这篇文章中我主要讲一下使用Navicat更改的方法。
实现
使用Navicat连接数据库并修改格式
执行命令批量解决问题
use typecho;
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;
修改站点配置文件
config.inc.php
中
$db->addServer(array (
'host' => localhost,
'user' => 'youruser',
'password' => 'yourpassword',
'charset' => 'utf8mb4', //修改这一行 utf8 -> utf8mb4
'port' => 3306,
'database' => 'yourdatabase'
), Typecho_Db::READ | Typecho_Db::WRITE);