[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

 Connect to the database using the idea of ​​the time, being given

[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

 

Later, access to information that this is not correct because when the time zone setting mysql install mysql default is the time zone of the United States, mainland China and we are better than them no later than eight hours, the use of +8: 00 format. MySQL database is used, in case you do not specify a drive version of its MySQL automatically dependent on driving high version is 8.0.12, which is due to the time zone difference between databases and systems caused by back url in jdbc connection plus serverTimezone = GMT to solve the problem, if you need to use gmt + 8 time zone, you need to write GMT% 2B8, otherwise it will be resolved to empty. Still another solution is the use of low version of the MySQL jdbc driver, 5.1.28 time zone problem will not exist.

 

Behind the connection string together? ServerTimezone = UTC
where UTC is a unified world standard time.
Complete connection string example: jdbc: mysql: // localhost: 3306 / test serverTimezone = UTC?
Or there is another option: jdbc: mysql: //127.0.0.1:? 3306 / test useUnicode = true & characterEncoding = UTF- 8, this input is to solve the Chinese garbled question, of course, also be combined together and above: jdbc: mysql: //127.0.0.1: 3306 / test useUnicode = true & characterEncoding = UTF-8 & serverTimezone = UTC?


Another situation changed: jdbc: mysql: // localhost: 3306 / test job after = GMT serverTimezone?.
jdbc is mysql-connector-java-8.0.11.jar, provided outdated region set time_zone = '+8: 00'

Summary: The emergence of this problem look at their own time zone system is set to UTC or GMT, find the corresponding solution

Guess you like

Origin www.cnblogs.com/qingmuchuanqi48/p/11372592.html