天天看點

使用最新版本MySQL8.0.12報錯記錄使用最新版本MySQL8.0.12報錯記錄

使用最新版本MySQL8.0.12報錯記錄

報錯1:

Sun Oct 14 00:45:30 CST 2018 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.

不建議在沒有伺服器身份驗證的情況下建立SSL連接配接。根據MySQL 5.5.45+,5.6.26+和5.7.6+的SSL連接配接要求,如果未設定連接配接方式,則預設情況下必須建立SSL連接配接。對于不使用SSL的現有應用程式,伺服器的驗證證書屬性設定為“false”。您需要通過設定useSSL=false來顯式禁用SSL,或者設定useSSL=true并提供伺服器的驗證證書。

解決方法:

1、資料庫URL連接配接位址添加useSSL=false,适用于測試。

2、資料庫URL連接配接位址添加useSSL=true,并且提供伺服器的驗證證書。

jdbc.url=jdbc:mysql://127.0.0.1:3306/demo?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT&useSSL=false

報錯2

2018-10-14 00:45:30,876 ERROR [DruidDataSource.java:616] : init datasource error

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.

伺服器時區值“????±××?±?無法識别或代表一個以上的時區。如果希望利用時區支援,則必須配置伺服器或JDBC驅動程式(通過serverTimezone配置屬性)以使用更具體的時區值。

使用的MySQL資料庫版本8.0.12,資料庫連接配接驅動是8.0.12。

由于資料庫和系統時區差異造成報錯,需要在資料庫URL連接配接位址後面加上serverTimezone=GMT。

如果需要使用gmt+8時區,需要寫成GMT%2B8,否則會被解析為空。

<dependency>

    <groupId>mysql</groupId>

    <artifactId>mysql-connector-java</artifactId>

    <version>8.0.12</version>

</dependency>

報錯3:

Loading class `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 class is generally unnecessary.

不建議使用驅動類'com.mysql.jdbc.Driver'。新的驅動程式類是'com.mysql.cj.jdbc.Driver',驅動程式是通過SPI自動注冊的,通常是不需要手動加載驅動類。

MySQL資料庫8.0.12使用的驅動類為com.mysql.cj.jdbc.Driver,不要使用舊的驅動類。

jdbc.driverClass=com.mysql.cj.jdbc.Driver

--------------------- 

作者:xinxin19881112 

來源:CSDN 

原文:

https://blog.csdn.net/xinxin19881112/article/details/83044094

版權聲明:本文為部落客原創文章,轉載請附上博文連結!