MySQL 5.7 has always been used before, because some changes have taken place after updating to MySQL 8.0, and some information needs to be modified in the configuration of MySQL driver connection.
In MySQL version 5.7, getting the database connection is realized by the following code
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/数据库名称","数据库账号","数据库密码");
In MySQL 8.0, you need to add a time zone. The implementation code is as follows
connection = DriverManager.getConnection(” jdbc:mysql :// localhost:3306/ Database name true & amp; characterEncoding=utf-8&& amp; serverTimezone=GMT%2B8& Usessl = false “,” database account “,” database password “);
After completing the above modification, you can perfectly solve the connection problem of mysql8.0. The connection is successful, as shown in the figure below
- [Solved] Description: Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded
- MySQL (version 8.0) connection error: 1251 [How to Solve]
- [Solved] C# connecting to MySQL database reports an error
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- Using Mybatis to connect to the database error: Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver···
- Docker mysql8 modify password
- [Solved] There is a problem with mysql8.0 without password in Navicat connection
- Mybatis Error: The server time zone value ‘����1532a0’ is unrecognized
- [Solved] docker mysql SQLSTATE[HY000]  Connection refused
- [Solved] com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
- [Solved] MySQL Error: Client does not support authentication protocol requested by server
- Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 – Connection is not available, request timed out after 30005ms.
- IDEA maven Config MYSQL Connection Error: Could not create connection to database server.
- MYSQL Error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: Yes)
- [Solved Perfectly] MySQL ERROR 1064 (42000): You have an error in your SQL syntax;
- [Solved] Caused by: java.sql.SQLException: Access denied for user ‘root‘@‘hadoop102‘ (using password: YES)
- After installing mysql5.7 on centos7, an error 1045 (28000) is reported: access denied for user ‘root’ @’localhost ‘(using PAS)
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- Mysql184.108.40.206 Error 1054 (42S22): Unknown Column’password’ In’field List’ When Changing User Password
- [Solved] Connections could not be acquired from the underlying database