欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

eclipse——Java连接MySQL遇到的问题

程序员文章站 2022-03-03 17:41:30
...

Java连接MySQL遇到的问题

①Could not create connection to database server.
原因:驱动包版本不一致
解决:重新导入与MySQL版本一致的jar包

②出现警告:Establishing SSL connection without server’s identityverification 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 optionisn’t set. For compliance with existing applications not using SSL theverifyServerCertificate property is set to ‘false’. You need either toexplicitly disable SSL by setting useSSL=false, or set useSSL=true and providetruststore for server certificate verification.
解决:https://blog.csdn.net/Amluee/article/details/80610286

③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.
解决:上面的链接也有讲到,在
DriverManager.getConnection(URL,用户名,密码)
方法的URL里面加上

&serverTimezone=Hongkong