mysql 支持表情設(shè)置
MySQL數(shù)據(jù)庫版本要5.5.3及以上
修改數(shù)據(jù)庫配置文件 /etc/my.cnf 并重啟mysql服務(wù)
[client]
客戶端來源數(shù)據(jù)的默認(rèn)字符集
default-character-set = utf8mb4
[mysqld]
服務(wù)端默認(rèn)字符集
character-set-server=utf8mb4
連接層默認(rèn)字符集
collation-server=utf8mb4_unicode_ci
[mysql]
數(shù)據(jù)庫默認(rèn)字符集
default-character-set = utf8mb4
修改后重啟Mysql
登陸MYSQL, show variables like 'character%'; 可以查看編碼是否已經(jīng)修改成功煤墙。
修改表結(jié)構(gòu)
alter table TABLE_NAME convert to character set utf8mb4 collate utf8mb4_bin; (將TABLE_NAME替換成你的表名)