如果报错或提示:
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.
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.
可以这样修改:
1.以前版本
(1)加载JDBC驱动:Class.forName(“com.mysql.jdbc.Driver”);
(2)链接URL:
("jdbc:mysql://localhost:3306/hello","root","123456");
2.本人所用版本(mysql8.0.13 + mysql-connector-java-8.0.13(JDBC) + jdk11.0.1 )
(1)加载JDBC驱动:Class.forName(“com.mysql.cj.jdbc.Driver”);
(2)链接URL:
( "jdbc:mysql://localhost:3306/hello?serverTimezone=GMT%2B8","root","123456");