https://mp.weixin.qq.com/s?__biz=MzU4NDc1NDMxMw==&mid=2247486462&idx=1&sn=7c490f075e3b7d704ae8415a6afd3c30&chksm=fd95be18cae2370e4001eada1c3e33efe6dd5fb8afd5024aa17d001f8609b2c4d821a03280c4&mpshare=1&scene=24&srcid=0731Pfqoe5YwXNCvN7dx9vzl&sharer_sharetime=1690810969120&sharer_shareid=117fe97901760e8f49be5fb1b15e01ac#rd
utf8如何转为utf8mb4
https://mathiasbynens.be/notes/mysql-utf8mb4#utf8-to-utf8mb4
其他参考:
https://it.cha138.com/javascript/show-6291125.html
配置文件
[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
检查参数
mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' 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 |
| collation_connection | utf8mb4_unicode_ci |
| collation_database | utf8mb4_unicode_ci |
| collation_server | utf8mb4_unicode_ci |
+--------------------------+--------------------+
10 rows in set (0.00 sec)