spring框架中配置mysql8.0需要注意的地方(转载)

8.0以后的mysql很强大,但是配置写法出现了不同

主要原因是时区不同,mysql默认用的是国外某个地方的时区,而我们要用的话用使用东八时区,这是中国统一时区。

装载自https://blog.csdn.net/sunshunli/article/details/104360356

 

spring中xml配置文件写法:

<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/数据库名称?characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8"></property>





 

  

new 对象

jdbc:mysql://localhost:3306/数据库名称?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false






 

posted @ 2020-06-22 21:35  小小记录本  阅读(1271)  评论(0编辑  收藏  举报