MySQL java 驱动包 8.0.11
http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.11/mysql-connector-java-8.0.11.jar
问题一
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自动注册,通常不需要手动加载驱动程序类。
解决方法:
之前:
String driver = "com.mysql.jdbc.Driver";
改之后:
String driver = "com.mysql.cj.jdbc.Driver";
问题二
Mon Jul 30 20:05:48 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.
翻译
周一7月30日20:05:48 CST 2018警告:不建议在没有服务器身份验证的情况下建立SSL连接。 根据MySQL 5.5.45 +,5.6.26 +和5.7.6+要求如果未设置显式选项,则必须默认建立SSL连接。 为了符合不使用SSL的现有应用程序,verifyServerCertificate属性设置为“false”。 您需要通过设置useSSL = false显式禁用SSL,或者设置useSSL = true并为服务器证书验证提供信任库。
解决办法:在 url 后添加 useSSL=false
原先:
String driver = "com.mysql.cj.jdbc.Driver";
String url = "jdbc:mysql://127.0.1.1:3306/sqltest";
改之后:
String driver = "com.mysql.cj.jdbc.Driver";
String url = "jdbc:mysql://127.0.1.1:3306/sqltest?useSSL=false";
问题三:
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配置属性)以使用更具体的时区值。
解决办法:在 url 后加 serverTimezone=GMT 如果需要使用gmt+8时区,需要写成serverTimezone=GMT%2B8
之前:
String driver = "com.mysql.cj.jdbc.Driver";
string url = "jdbc:mysql://127.0.1.1:3306/sqltest?useSSL=false";
改之后:
String driver = "com.mysql.cj.jdbc.Driver";
String url = "jdbc:mysql://127.0.1.1:3306/sqltest?useSSL=false&&serverTimezone=GMT%2B8";
其中 && 可以只写成 &,测试可用
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.youkuaiyun.com/qq_37131037/article/details/81291470