Participation website: 1, https://www.cnblogs.com/centor/p/6142775.html
2, 53378755
3, 52292099
First, refer to the above website for download:
MySQL Connection driver: mysql-connector-java-8.0.11.
Add a connection driver package to your project based on the reference website tutorial.
Then the copy of Site 1 code runs after the error occurs.
Loading class ' Com.mysql.jdbc.Driver '. This is deprecated. And
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 is established by default if explicit Opti On isn ' t set.
and the server time zone value '??? Ú±êx?? ±?? is a unrecognized or represents more than one time zone.
I looked it up on the Internet.
First error: This error is better resolved, change the com.mysql.jdbc.Driver to Com.mysql.cj.jdbc.Driver.
Second error: The current version of MySQL requires the use of SSL,
Third error: you need to add a parameter after the URL:
So put: String url = "Jdbc:mysql://localhost:3306/user_password"; Make the following changes:
String url = "Jdbc:mysql://localhost:3306/user_password?servertimezone=utc&usessl=false";
Knowledge Point Supplement:
Connector driver Reference Document: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference.html
http://elf8848.iteye.com/blog/1684414
Connect MySQL database through JDBC with Java summary