java.sql.SQLException: Incorrect string value: ‘\xE7\x9A\x84‘ for column ‘name‘ at row 1
在创建创建数据库设置
CREATE DATABASE IF NOT EXISTS database_name DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
创建时未设置可以通过以下方法解决
1)修改字段字符集
ALTER TABLE table_name CHANGE column_name VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
2)设置表的字符集
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
3)设置数据库的字符集
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;