Hibernate + MySQL: How to set the encoding utf-8 for database and tables

后端 未结 9 2178
故里飘歌
故里飘歌 2020-12-13 00:34

My system runs on Linux Mandriva, RDBMS - MySQL 5. I need to have the database and tables created in UTF-8.

Here i

9条回答
  •  情歌与酒
    2020-12-13 01:23

    For those who use Spring Boot: add the characterEncoding=utf8 parameter to your application.properties file to this line:

    spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase?useUnicode=true&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    

提交回复
热议问题