野火IM连接mysql数据库,一直报时区问题

shuye 2019-11-14 1094

使用的是野火distribution-0.29-bundle-tar.tar.gz版本,win10下启动,使用了mysql数据库

连接时报错:WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.  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.         at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:127)         at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)         at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:87)         at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:61)         at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:71)         at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)         at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:862)         at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:444)         at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230)         at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226)         at java.sql.DriverManager.getConnection(DriverManager.java:664)         at java.sql.DriverManager.getConnection(DriverManager.java:247)         at win.liyufan.im.DBUtil.init(DBUtil.java:88)         at io.moquette.server.Server.startServer(Server.java:223)         at io.moquette.server.Server.startServer(Server.java:215)         at io.moquette.server.Server.startServer(Server.java:199)         at io.moquette.server.Server.start(Server.java:109)         at cn.wildfirechat.server.Server.main(Server.java:15)

网上找到解决方法:

1.jdbcUrl后面加参数?useSSL=false&serverTimezone='xx'

但还是报错,无法解决问题

2.根据野火的常见问题解决,直接修改mysql的时区

在mysql的配置文件my.ini中[mysqld]下配置default-time-zone = '+8:00',问题解决,mysql数据库可以连接了

但还是有警告:

WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 

现在问题:

1.为什么jdbcUrl后面加参数确无法传递到mysql上呢,是flyway这个工具不支持参数传递吗?

2.每次部署需要修改mysql数据库配置,而不能通过jdbcUrl参数传递控制,造成部署不便,有什么修改方法吗?

最新回复 (4)
  • saber 2019-11-14
    引用 2
    The server time zone value '???ú±ê×??±??' is unrecognized 
    应该是时区没有对吧,我这边用的官方的useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8没有任何问题呀
  • pps无头 2019-11-14
    引用 3
    我也是这个情况
  • shuye 2019-11-14
    引用 4
    saber The server time zone value '???ú±ê×??±??' is unrecognized 应该是时区没有对吧,我这边用的官方的useSSL=false&s ...
    我这边是使用distribution-0.29-bundle-tar.tar.gz这个版本的包,更改数据库为mysql后,在c3p0-config.xml这个配置文件jdbcUrl写了useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8,使用bin\wildfirechat.bat命令启动后,就报错了。
    我没有试过下载源码在idea里启动,所以您这边也是tar包解压后启动没问题吗?
  • 淘气柚子 2021-7-27
    引用 5
    我也报时区错误
返回