MySQL 存储 Emoji 表情

MySQL Emoji About 886 words

查看 MySQL 字符集

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

查看数据库字符集

show create database test;

临时设置字符集

重启后失效

# 客户端字符集
set character_set_client=utf8mb4;
# 链接字符集
set character_set_connection=utf8mb4;
# 数据库字符集
set character_set_database=utf8mb4;
# 结果字符集
set character_set_results=utf8mb4;
# 服务器字符集
set character_set_server=utf8mb4;
# 系统字符集
set character_set_system=utf8mb4;
# 链接校对
set collation_connection=utf8mb4_general_ci;
# 数据库校对
set collation_database=utf8mb4_general_ci;
# 服务器校对
set collation_server=utf8mb4_general_ci;

修改配置文件 my.conf

如没有[client] [mysql] [mysqld]需手动添加

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'

重启 MySQL

service mysql restart
Views: 1,781 · Posted: 2019-04-07

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh