Solve the problem of eight hours time difference in MySQL insertion Generally, several parameters need to be added to the jdbc url. Most blogs give tutorials with these parameters: The configuration result is: To solve the time zone problem, I used serverTimezone=UTC in the past, but I ran into a small pit today and realized that this is not a panacea. First, insert a record normally It is found that the database record time is different from the local time The first method: Check the time in MySQL First use mysql -u username -p password in cmd to log in to mysql Enter Check MySQL time If the time is consistent with your local current time This means that there is no problem with MySQL time, but the problem lies with Java time. Try changing the jdbc url parameter to Second: If the query MySQL time is inconsistent with the local time, use the following statement to set the MySQL time zone show variables like '%time_zone%'; //Query the current time zone set global time_zone='+8:00'; //Add +8 hours to the standard time zone, i.e. Eastern Time Zone 8 flush privileges; # Take effect immediately Final test results success Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Introduction and use of js observer mode
Preface Before talking about covering index, we m...
Solution to 1449 and 1045 exceptions when connect...
According to null-values, the value of null in My...
<br />I just saw the newly revamped ChinaUI....
It’s great to use CSS to realize various graphics...
We need to first combine the air quality data wit...
Implementation principle The main graphics are co...
About JS, CSS CSS: Stylesheet at the top Avoid CS...
This article uses examples to describe the add, d...
The Meta tag is an auxiliary tag in the head area...
Table of contents SQL execution order bin log Wha...
1. Official website address The official website ...
1. Download the ubuntu16.04 image and the corresp...
After I published my last article “Zen Coding: A Q...
1. Data backup 1. Use mysqldump command to back u...