To view time zones:
' %time_zone% ' ; +------------------+--------+| Variable_name | Value |+------------------+--------+| System_time_zone | CST | | time_zone | SYSTEM |+------------------+--------+2 in Set (0.02 sec)
Check the current time is also normal:
Select Now (); +---------------------+| Now ()-All: |+---------------------+ 1 in Set (0.00 sec)
But Java writes are less than 14 hours. This is because: when parsing a precompiled statement, the CST (China Standard Time utc+8) is mistakenly parsed into a CST (Central standards Tim UTC-6), which is less than 14 hours.
Workaround:
' the ' 0 rows affected (0.00 sec) MySQL'%time_zone%'; +------------------+--------+| Variable_name | Value |+------------------+--------+| System_time_zone | CST | | time_zone | +: |+ ------------------+--------+2 in Set (0.04 sec)
MySQL Java write time 14 hours less