Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当有人试图将笑脸插入我的数据库时,我偶尔会遇到以下异常:
Incorrect string value: '\xF0\x9F\x98\x8A' for column 'name' at row 1
名称定义为
`name` VARCHAR(255) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL,`
我CharSet=utf8;在我的连接字符串中使用
CharSet=utf8;
我还应该检查/更改完整的 unicode 插入以开始工作吗?
您必须将您collation的数据库更改table为utf8mb4_bin
collation
table
utf8mb4_bin
并将数据库配置中的 CHARACTER SET 设置为utf8mb4
utf8mb4