mysql 无法存储表情字符 java.sql.SQLException: Incorrect string value: '\xF0\x9F\x90\xBE",...' for column 'XXXX' at row 1
1、变更字段类型
ALTER TABLE api_log MODIFY COLUMN remark longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
2、配置数据库链接
url="jdbc:mysql://XXXXXXX/dbName?useSSL=false&useUnicode=true&characterEncoding=utf8&autoReconnect=true"
3、建表时
create table tableName1
(
id int not null auto_increment,
opName varchar(100) not null,
sysUrl varchar(200) not null,
createId varchar(36) not null,
createName varchar(100) not null,
createTime varchar(19) not null,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
李小家