1. 查看数据库编码
查看数据库表
show create table kzz;
2. 修改数据库编码
ALTER DATABASE finance CHARACTER SET `utf8` ;
ALTER DATABASE finance COLLATE `utf8mb4_general_ci`;
建表:
ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
3. 设置数据库连接编码
jdbc:mysql://localhost:3306/<数据库名>?useUnicode=true&characterEncoding=utf8