步骤 1:下载版本对应驱动 https://mvnrepository.com/artifact/mysql/mysql-connector-java
2 : 载入引用包内
3: 配置JDBC.properties:注意jdbc.driver与jdbc.url和旧版的不
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/hello?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
jdbc.username=root
jdbc.password=password
有可能出现的问题;
1 mysql 连接出现The last packet sent successfully to the server was 0 milliseconds ago.
尝试途径:在my.ini文件中添加,注意要顶格,前面不能有空格。
[mysql]
wait_timeout=86400
2 出现 Public Key Retrieval is not allowed
在jdbc.url后面添加 ‘’ &allowPublicKeyRetrieval=true ‘’