插入中文到mysql数据库变成问号,解决

在application.yml文件中配置数据源时后面跟上编码配置即可。?useUnicode=true&characterEncoding=UTF-8

spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/hzxx_shixi?useUnicode=true&characterEncoding=UTF-8
    username: root
    password: root
posted @ 2020-04-20 15:32  wqkeep  阅读(641)  评论(0编辑  收藏  举报