In the Maven
project. When I first set up XAMPP
and MySQL
work very well. But inside NetBeans
I can't connect to the MySQL
and can't create a connect to the mysql-connector-java-8.0.20.zip or mysql-connector-java-8.0.20.jar . driver="com.mysql.cj.jdbc.Driver"
and url="jdbc:mysql://localhost:3306/mysql"
When I going to add new connection to MySQL
it display error message,
Cannot establish a connection to jdbc:mysql://localhost:3306/mysql using com.mysql.cj.jdbc.Driver (The server time zone value 'unknown' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver
"The server time zone value 'unknown' is unrecognized or represents more than one-time zone" This is a common error in MySQL to fix this error.
1)Create a new connection to MySQL
2)Connect JDBC driver to using mysql-connector-java-8.0.20.jar
3)In JDBC URL add server time zone as follows make sure your database name is mysql otherwise change the database name to your database name.
jdbc:mysql://localhost:3306/mysql?serverTimezone=UTC
NB:- If you want you can add server time zone as a connection property set property as serverTimezone and value as UTC.
If this didn't work use MariaDb driver to connect MySQL
1)Create a new connection
2)Add mariadb-java-client-2.6.0 to the connection
3)In JDBC URL add as follows and you don't want to worry about server time zone when you use MariaDB
jdbc:mariadb://localhost:3306/mysql
It looks like you're running on windows but the solution for me involved customizing the mysql driver. On the netbeans services tab open the drivers folder right-click the mysql connector/driver and then cutomize. Locate your driver on your system and add it to the class then click ok. Worked for me on ubuntu
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.