mysql常用配置语句
在java开发中经常需要配置的mysql语句:
spring:
datasource:
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
尤其是url,
jdbc:mysql://localhost:3306 ----------- 本地mysql,端口号3306
test ------------ 数据库名
useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC ---- 设置字符集和时区