1. 查看数据库编码

  1. 查看数据库表
  2. show create table kzz;

2. 修改数据库编码

  1. ALTER DATABASE finance CHARACTER SET `utf8` ;
  2. ALTER DATABASE finance COLLATE `utf8mb4_general_ci`;
  3. 建表:
  4. ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

3. 设置数据库连接编码

  1. jdbc:mysql://localhost:3306/<数据库名>?useUnicode=true&characterEncoding=utf8