在学习到JDBC时下载了现下最新版的mysql(mysql-8.0.17-winx64)下载链接:https://cdn.mysql.com//Downloads/MySQLInstaller/mysql-installer-community-8.0.17.0.msi
mysql-connector-java-8.0.17.jar 下载链接:http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.17/mysql-connector-java-8.0.17.jar
坑1:
发现通过“com.mysql.jdbc.Driver”连接不上
解决:原来是8.0以上版本改为了:“com.mysql.cj.jdbc.Driver”
坑2:
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:mysql://localhost:3306/mysql"改为"jdbc:mysql://localhost:3306/mydb?serverTimezone=UTC"
查看mysql的时区: