1Mysql版本的相关问题:com.mysql.cj.jdbc.Driver和com.mysql.jdbc.Driver1. 在使用mysql时,控制台日志报错如下:
23Loadingclass`com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.The driver is automatically registered via the SPI and manual loading of the driver classis generally unnecessary.45报错原因: mysql5用的驱动url是com.mysql.jdbc.Driver,mysql6以后用的是com.mysql.cj.jdbc.Driver。版本不匹配便会报驱动类已过时的错误。 解决方法: 更改配置文件中的驱动类名字就可以消除驱动类过时的警告了。 2.JDBC连接Mysql6 (com.mysql.cj.jdbc.Driver), 需要指定时区serverTimezone,否则会报如下错误,
1org.mybatis.spring.MyBatisSystemException:2 nested exception is org.apache.ibatis.exceptions.PersistenceException:3 ### Error querying database.4Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:5Could not getJDBCConnection; nested exception is org.apache.commons.dbcp.SQLNestedException:6Cannot create PoolableConnectionFactory(The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone.You must configure either the server or JDBCdriver(via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.)
3.还有一个警告:
1WARN:EstablishingSSL 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.23/**不推荐不使用服务器身份验证来建立SSL连接。 如果未明确设置,MySQL 5.5.45+, 5.6.26+ and 5.7.6+版本默认要求建立SSL连接。 为了符合当前不使用SSL连接的应用程序,verifyServerCertificate属性设置为’false’。 如果你不需要使用SSL连接,你需要通过设置useSSL=false来显式禁用SSL连接。 如果你需要用SSL连接,就要为服务器证书验证提供信任库,并设置useSSL=true。**/