【mysql】让数据库支持emoji表情

依然范儿特西
2021-06-17 / 0 评论 / 47 阅读 / 正在检测是否收录...

此处我们以typecho的文章表为例

依次执行下列sql

ALTER DATABASE typecho_blog CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE typecho_blog.typecho_contents CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

查看结果

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

显示如下,即为成功!

Variable_name              Value

character_set_client       utf8mb4
character_set_connection   utf8mb4
character_set_database       utf8mb4
character_set_filesystem   binary
character_set_results       utf8mb4
character_set_server       utf8mb4
character_set_system       utf8
character_sets_dir       /www/server/mysql/share/charsets/
collation_connection       utf8mb4_general_ci
collation_database       utf8mb4_unicode_ci
collation_server       utf8mb4_general_ci
0

评论 (0)

取消