gpt4 book ai didi

MySQL utf8mb4 unicode(笑)

转载 作者:行者123 更新时间:2023-11-30 21:54:38 25 4
gpt4 key购买 nike

所以,今天我遇到了问题:

SQL 请求:

INSERT INTO `sample` (`lol`) VALUES ('👈');

响应:

Error Code: 1366. Incorrect string value: '\xF0\x9F\x91\x88' for column 'lol' at row 1

整理:

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, 1 warning (0.00 sec)

我的.ini:

[client]
port=3306
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
collation-server = utf8mb4_unicode_ci
character-set-server=utf8mb4

MySQL Workbench Screenshot

Database structure

如何解决?

最佳答案

解决方案很简单。你只需要做设置名称“utf8mb4”

关于MySQL utf8mb4 unicode(笑),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45756840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com