关于使用 myeclipse连接MySql的问题

配置Hibernate.cfg.xml测试连接Mysql数据库时老是报错,如下图:

想想这样配置也没有错啊,可是一直测试连接不上。后面上查了一下,需要在连接字符串后面加上?serverTimezone=UTC ,其中UTC是统一标准世界时间。

完整的连接字符串示例:jdbc:mysql://localhost:3306/student?serverTimezone=UTC

加上后测试连接然后就可以连接上了

PS:或者还有另一种选择:jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=utf-8,这个是解决中文乱码输入问题,当然也可以和上面的一起结合:jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC

原文地址:https://www.cnblogs.com/lichengcai/p/7672785.html