如何在MySQL数据库中存储Emoji字符我在我的项目中使用了Emoji字符。角色被保存(?)进入MySQL数据库。中使用了数据库默认排序规则。utf8mb4_general_ci..它显示1366不正确的字符串值:‘\xF0\x9F\x98\x83\xF0\x9F.’对于第1行的“注释”一栏
3 回答
绝地无双
TA贡献1946条经验 获得超4个赞
utf8mb4
.
CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
.
ALTER TABLE Tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
INSERT INTO tablename (column1, column2, column3, column4, column5, column6, column7)VALUES ('273', '3', ' Hdhdhdhhzhzhzzhjzj 我爱你 ', 49, 1, '2016-09-13 08:02:29', '2016-09-13 08:02:29')
utf8mb4
$database_connection = new mysqli($server, $user, $password, $database_name); $database_connection->set_charset('utf8mb4');
呼如林
TA贡献1798条经验 获得超3个赞
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS table_name (...) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;ALTER TABLE table_name modify name text charset utf8mb4;
添加回答
举报
0/150
提交
取消