MyBatits遇到的几个错误(5.13)

TokaiTeio32 / 2023-05-13 / 原文

问题描述

Cause: java.sql.SQLException: The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决方法

mybatis-config.xml配置文件中添加

serverTimezone=Asia/Shanghai&

<property name="url" value="jdbc:mysql:///student?serverTimezone=Asia/Shanghai&amp;useSSL=false"/>
详细方法
 

问题描述

连接数据库报错com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

解决方法

mybatis-config.xml配置文件中添加

&useSSL=false

<property name="url" value="jdbc:mysql:///student?serverTimezone=Asia/Shanghai&amp;useSSL=false"/>

或者是链接数据库信息出错

<!--数据库连接信息-->
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql:///mybatis?useSSL=false"/>
<property name="username" value="root"/>
<property name="password" value="1234"/>
</dataSource>