Operating system: ubuntu
IDE:idea
Database: Mysql
When I use php to operate the database, there is no problem with Chinese display, and Chinese can be displayed normally:
But when I was learning spring and operating the database, question marks would appear in Chinese and could not be displayed normally
The database configuration I wrote in spring
# 在項目初始化時,重新創(chuàng)建數(shù)據(jù)表
spring.jpa.hibernate.ddl-auto=update
# 指定連接的類型為mysql 連接的地址為:localhost 端口為3306 ,數(shù)據(jù)為springmvc
spring.datasource.url=jdbc:mysql://localhost:3306/springmvc
# 用戶名為root
spring.datasource.username=root
# 密碼為空
spring.datasource.password=
# 顯示SQL語句
spring.jpa.show-sql=true
My database and idea are both encoded in utf_8. Why does this problem occur?
Modification
spring.datasource.url=jdbc:mysql://localhost:3306/springmvc
for
spring.datasource.url=jdbc:mysql://localhost:3306/springmvc?useUnicode=true&characterEncoding=utf-8