Spring-Boot, Can't save unicode string in MySql using spring-data JPA

前端 未结 6 1414
一整个雨季
一整个雨季 2020-12-20 18:04

I have my application.properties set up like this :

spring.datasource.username = root
spring.datasource.password = root
spring.datasource.url =         


        
6条回答
  •  Happy的楠姐
    2020-12-20 18:25

    Keep your hibernate configuration Like this

    jdbc:mysql://localhost:3306/dbname?useUnicode=yes&characterEncoding=UTF-8

    And Change your DB Collation Like this

    ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    

    More information : Link

提交回复
热议问题