1. 程式人生 > >mysql-connector-java 6.x 時區設定

mysql-connector-java 6.x 時區設定

       最近遇到了一個問題,java從mysql從讀出的時間與本地時間有14個小時的時間差,經查證、測試解決了此問題,在此總結一下:

一、使用mysql-connector-java 6.x版本驅動需要做如下配置:

1、引入pom

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>6.0.6</version>
</dependency>

2、設定jdbc連線、驅動

jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&serverTimezone=UTC&characterEncoding=utf-8&allowMultiQueries=true

com.mysql.cj.jdbc.Driver

二、設定mysql資料時區

1、檢視mysql時區

show variables like "%time_zone%"

技術分享

2、修改mysql時區

(1)方法一

set global time_zone = ‘+8:00‘; ##修改mysql全域性時區為北京時間,即我們所在的東8區
set time_zone = ‘+8:00‘; ##修改當前會話時區
flush privileges; #立即生效

(2)方法二、通過修改my.cnf配置檔案來修改時區

# vim /etc/my.cnf ##在[mysqld]區域中加上
default-time_zone = ‘+8:00‘
# /etc/init.d/mysqld restart ##重啟mysql使新時區生效

三、分析時區設定問題

       通過上面的設定,我們把mysql資料庫的時區設定成了中國的時區‘utc+8’,而serverTimezone=UTC設定的是utc時區,兩者不同,所以會發現從資料庫讀出的時間與本地時間差幾個小時。要解決這個問題,需要讓serverTimezone的設定與資料庫的時區保持一致。我們可以選擇修改serverTimezone的設定為serverTimezone=Asia/Shanghai,或者修改資料庫的時區為‘+0:00’。

四、serverTimezone支援的值說明

1、utc時區:serverTimezone=UTC

2、中國時區:serverTimezone=GMT%2B8(GMT+8這種方式支援全部時區,通過修改最後的數字實現,不過%2B不能寫成+)

3、檢視官方原始碼,可以看到serverTimezone支援的相關設定如下,如:中國的時區可設定為:serverTimezone=Asia/Shanghai

#Windows Zones
#Mon Sep 28 16:41:59 WEST 2015
AUS\ Central\ Daylight\ Time=Australia/Darwin
AUS\ Central\ Standard\ Time=Australia/Darwin
AUS\ Eastern\ Daylight\ Time=Australia/Sydney
AUS\ Eastern\ Standard\ Time=Australia/Sydney
Afghanistan\ Daylight\ Time=Asia/Kabul
Afghanistan\ Standard\ Time=Asia/Kabul
Alaskan\ Daylight\ Time=America/Anchorage
Alaskan\ Standard\ Time=America/Anchorage
Arab\ Daylight\ Time=Asia/Riyadh
Arab\ Standard\ Time=Asia/Riyadh
Arabian\ Daylight\ Time=Asia/Dubai
Arabian\ Standard\ Time=Asia/Dubai
Arabic\ Daylight\ Time=Asia/Baghdad
Arabic\ Standard\ Time=Asia/Baghdad
Argentina\ Daylight\ Time=America/Buenos_Aires
Argentina\ Standard\ Time=America/Buenos_Aires
Atlantic\ Daylight\ Time=America/Halifax
Atlantic\ Standard\ Time=America/Halifax
Azerbaijan\ Daylight\ Time=Asia/Baku
Azerbaijan\ Standard\ Time=Asia/Baku
Azores\ Daylight\ Time=Atlantic/Azores
Azores\ Standard\ Time=Atlantic/Azores
Bahia\ Daylight\ Time=America/Bahia
Bahia\ Standard\ Time=America/Bahia
Bangladesh\ Daylight\ Time=Asia/Dhaka
Bangladesh\ Standard\ Time=Asia/Dhaka
Belarus\ Daylight\ Time=Europe/Minsk
Belarus\ Standard\ Time=Europe/Minsk
Canada\ Central\ Daylight\ Time=America/Regina
Canada\ Central\ Standard\ Time=America/Regina
Cape\ Verde\ Daylight\ Time=Atlantic/Cape_Verde
Cape\ Verde\ Standard\ Time=Atlantic/Cape_Verde
Caucasus\ Daylight\ Time=Asia/Yerevan
Caucasus\ Standard\ Time=Asia/Yerevan
Cen.\ Australia\ Daylight\ Time=Australia/Adelaide
Cen.\ Australia\ Standard\ Time=Australia/Adelaide
Central\ America\ Daylight\ Time=America/Guatemala
Central\ America\ Standard\ Time=America/Guatemala
Central\ Asia\ Daylight\ Time=Asia/Almaty
Central\ Asia\ Standard\ Time=Asia/Almaty
Central\ Brazilian\ Daylight\ Time=America/Cuiaba
Central\ Brazilian\ Standard\ Time=America/Cuiaba
Central\ Daylight\ Time=America/Chicago
Central\ Daylight\ Time\ (Mexico)=America/Mexico_City
Central\ Europe\ Daylight\ Time=Europe/Budapest
Central\ Europe\ Standard\ Time=Europe/Budapest
Central\ European\ Daylight\ Time=Europe/Warsaw
Central\ European\ Standard\ Time=Europe/Warsaw
Central\ Pacific\ Daylight\ Time=Pacific/Guadalcanal
Central\ Pacific\ Standard\ Time=Pacific/Guadalcanal
Central\ Standard\ Time=America/Chicago
Central\ Standard\ Time\ (Mexico)=America/Mexico_City
China\ Daylight\ Time=Asia/Shanghai
China\ Standard\ Time=Asia/Shanghai
Dateline\ Daylight\ Time=Etc/GMT+12
Dateline\ Standard\ Time=Etc/GMT+12
E.\ Africa\ Daylight\ Time=Africa/Nairobi
E.\ Africa\ Standard\ Time=Africa/Nairobi
E.\ Australia\ Daylight\ Time=Australia/Brisbane
E.\ Australia\ Standard\ Time=Australia/Brisbane
E.\ South\ America\ Daylight\ Time=America/Sao_Paulo
E.\ South\ America\ Standard\ Time=America/Sao_Paulo
Eastern\ Daylight\ Time=America/New_York
Eastern\ Daylight\ Time\ (Mexico)=America/Cancun
Eastern\ Standard\ Time=America/New_York
Eastern\ Standard\ Time\ (Mexico)=America/Cancun
Egypt\ Daylight\ Time=Africa/Cairo
Egypt\ Standard\ Time=Africa/Cairo
Ekaterinburg\ Daylight\ Time=Asia/Yekaterinburg
Ekaterinburg\ Standard\ Time=Asia/Yekaterinburg
FLE\ Daylight\ Time=Europe/Kiev
FLE\ Standard\ Time=Europe/Kiev
Fiji\ Daylight\ Time=Pacific/Fiji
Fiji\ Standard\ Time=Pacific/Fiji
GMT\ Daylight\ Time=Europe/London
GMT\ Standard\ Time=Europe/London
GTB\ Daylight\ Time=Europe/Bucharest
GTB\ Standard\ Time=Europe/Bucharest
Georgian\ Daylight\ Time=Asia/Tbilisi
Georgian\ Standard\ Time=Asia/Tbilisi
Greenland\ Daylight\ Time=America/Godthab
Greenland\ Standard\ Time=America/Godthab
Greenwich\ Daylight\ Time=Atlantic/Reykjavik
Greenwich\ Standard\ Time=Atlantic/Reykjavik
Hawaiian\ Daylight\ Time=Pacific/Honolulu
Hawaiian\ Standard\ Time=Pacific/Honolulu
India\ Daylight\ Time=Asia/Calcutta
India\ Standard\ Time=Asia/Calcutta
Iran\ Daylight\ Time=Asia/Tehran
Iran\ Standard\ Time=Asia/Tehran
Israel\ Daylight\ Time=Asia/Jerusalem
Israel\ Standard\ Time=Asia/Jerusalem
Jordan\ Daylight\ Time=Asia/Amman
Jordan\ Standard\ Time=Asia/Amman
Kaliningrad\ Daylight\ Time=Europe/Kaliningrad
Kaliningrad\ Standard\ Time=Europe/Kaliningrad
Korea\ Daylight\ Time=Asia/Seoul
Korea\ Standard\ Time=Asia/Seoul
Libya\ Daylight\ Time=Africa/Tripoli
Libya\ Standard\ Time=Africa/Tripoli
Line\ Islands\ Daylight\ Time=Pacific/Kiritimati
Line\ Islands\ Standard\ Time=Pacific/Kiritimati
Magadan\ Daylight\ Time=Asia/Magadan
Magadan\ Standard\ Time=Asia/Magadan
Mauritius\ Daylight\ Time=Indian/Mauritius
Mauritius\ Standard\ Time=Indian/Mauritius
Middle\ East\ Daylight\ Time=Asia/Beirut
Middle\ East\ Standard\ Time=Asia/Beirut
Montevideo\ Daylight\ Time=America/Montevideo
Montevideo\ Standard\ Time=America/Montevideo
Morocco\ Daylight\ Time=Africa/Casablanca
Morocco\ Standard\ Time=Africa/Casablanca
Mountain\ Daylight\ Time=America/Denver
Mountain\ Daylight\ Time\ (Mexico)=America/Chihuahua
Mountain\ Standard\ Time=America/Denver
Mountain\ Standard\ Time\ (Mexico)=America/Chihuahua
Myanmar\ Daylight\ Time=Asia/Rangoon
Myanmar\ Standard\ Time=Asia/Rangoon
N.\ Central\ Asia\ Daylight\ Time=Asia/Novosibirsk
N.\ Central\ Asia\ Standard\ Time=Asia/Novosibirsk
Namibia\ Daylight\ Time=Africa/Windhoek
Namibia\ Standard\ Time=Africa/Windhoek
Nepal\ Daylight\ Time=Asia/Katmandu
Nepal\ Standard\ Time=Asia/Katmandu
New\ Zealand\ Daylight\ Time=Pacific/Auckland
New\ Zealand\ Standard\ Time=Pacific/Auckland
Newfoundland\ Daylight\ Time=America/St_Johns
Newfoundland\ Standard\ Time=America/St_Johns
North\ Asia\ Daylight\ Time=Asia/Krasnoyarsk
North\ Asia\ East\ Daylight\ Time=Asia/Irkutsk
North\ Asia\ East\ Standard\ Time=Asia/Irkutsk
North\ Asia\ Standard\ Time=Asia/Krasnoyarsk
Pacific\ Daylight\ Time=America/Los_Angeles
Pacific\ Daylight\ Time\ (Mexico)=America/Santa_Isabel
Pacific\ SA\ Daylight\ Time=America/Santiago
Pacific\ SA\ Standard\ Time=America/Santiago
Pacific\ Standard\ Time=America/Los_Angeles
Pacific\ Standard\ Time\ (Mexico)=America/Santa_Isabel
Pakistan\ Daylight\ Time=Asia/Karachi
Pakistan\ Standard\ Time=Asia/Karachi
Paraguay\ Daylight\ Time=America/Asuncion
Paraguay\ Standard\ Time=America/Asuncion
Romance\ Daylight\ Time=Europe/Paris
Romance\ Standard\ Time=Europe/Paris
Russia\ Time\ Zone\ 10=Asia/Srednekolymsk
Russia\ Time\ Zone\ 11=Asia/Kamchatka
Russia\ Time\ Zone\ 3=Europe/Samara
Russian\ Daylight\ Time=Europe/Moscow
Russian\ Standard\ Time=Europe/Moscow
SA\ Eastern\ Daylight\ Time=America/Cayenne
SA\ Eastern\ Standard\ Time=America/Cayenne
SA\ Pacific\ Daylight\ Time=America/Bogota
SA\ Pacific\ Standard\ Time=America/Bogota
SA\ Western\ Daylight\ Time=America/La_Paz
SA\ Western\ Standard\ Time=America/La_Paz
SE\ Asia\ Daylight\ Time=Asia/Bangkok
SE\ Asia\ Standard\ Time=Asia/Bangkok
Samoa\ Daylight\ Time=Pacific/Apia
Samoa\ Standard\ Time=Pacific/Apia
Singapore\ Daylight\ Time=Asia/Singapore
Singapore\ Standard\ Time=Asia/Singapore
South\ Africa\ Daylight\ Time=Africa/Johannesburg
South\ Africa\ Standard\ Time=Africa/Johannesburg
Sri\ Lanka\ Daylight\ Time=Asia/Colombo
Sri\ Lanka\ Standard\ Time=Asia/Colombo
Syria\ Daylight\ Time=Asia/Damascus
Syria\ Standard\ Time=Asia/Damascus
Taipei\ Daylight\ Time=Asia/Taipei
Taipei\ Standard\ Time=Asia/Taipei
Tasmania\ Daylight\ Time=Australia/Hobart
Tasmania\ Standard\ Time=Australia/Hobart
Tokyo\ Daylight\ Time=Asia/Tokyo
Tokyo\ Standard\ Time=Asia/Tokyo
Tonga\ Daylight\ Time=Pacific/Tongatapu
Tonga\ Standard\ Time=Pacific/Tongatapu
Turkey\ Daylight\ Time=Europe/Istanbul
Turkey\ Standard\ Time=Europe/Istanbul
US\ Eastern\ Daylight\ Time=America/Indianapolis
US\ Eastern\ Standard\ Time=America/Indianapolis
US\ Mountain\ Daylight\ Time=America/Phoenix
US\ Mountain\ Standard\ Time=America/Phoenix
UTC=Etc/GMT
UTC+12=Etc/GMT-12
UTC-02=Etc/GMT+2
UTC-11=Etc/GMT+11
Ulaanbaatar\ Daylight\ Time=Asia/Ulaanbaatar
Ulaanbaatar\ Standard\ Time=Asia/Ulaanbaatar
Venezuela\ Daylight\ Time=America/Caracas
Venezuela\ Standard\ Time=America/Caracas
Vladivostok\ Daylight\ Time=Asia/Vladivostok
Vladivostok\ Standard\ Time=Asia/Vladivostok
W.\ Australia\ Daylight\ Time=Australia/Perth
W.\ Australia\ Standard\ Time=Australia/Perth
W.\ Central\ Africa\ Daylight\ Time=Africa/Lagos
W.\ Central\ Africa\ Standard\ Time=Africa/Lagos
W.\ Europe\ Daylight\ Time=Europe/Berlin
W.\ Europe\ Standard\ Time=Europe/Berlin
West\ Asia\ Daylight\ Time=Asia/Tashkent
West\ Asia\ Standard\ Time=Asia/Tashkent
West\ Pacific\ Daylight\ Time=Pacific/Port_Moresby
West\ Pacific\ Standard\ Time=Pacific/Port_Moresby
Yakutsk\ Daylight\ Time=Asia/Yakutsk
Yakutsk\ Standard\ Time=Asia/Yakutsk
#Linked Time Zones alias
#Mon Sep 28 16:41:59 WEST 2015
Africa/Addis_Ababa=Africa/Nairobi
Africa/Asmara=Africa/Nairobi
Africa/Asmera=Africa/Nairobi
Africa/Bamako=Africa/Abidjan
Africa/Bangui=Africa/Lagos
Africa/Banjul=Africa/Abidjan
Africa/Blantyre=Africa/Maputo
Africa/Brazzaville=Africa/Lagos
Africa/Bujumbura=Africa/Maputo
Africa/Conakry=Africa/Abidjan
Africa/Dakar=Africa/Abidjan
Africa/Dar_es_Salaam=Africa/Nairobi
Africa/Djibouti=Africa/Nairobi
Africa/Douala=Africa/Lagos
Africa/Freetown=Africa/Abidjan
Africa/Gaborone=Africa/Maputo
Africa/Harare=Africa/Maputo
Africa/Juba=Africa/Khartoum
Africa/Kampala=Africa/Nairobi
Africa/Kigali=Africa/Maputo
Africa/Kinshasa=Africa/Lagos
Africa/Libreville=Africa/Lagos
Africa/Lome=Africa/Abidjan
Africa/Luanda=Africa/Lagos
Africa/Lubumbashi=Africa/Maputo
Africa/Lusaka=Africa/Maputo
Africa/Malabo=Africa/Lagos
Africa/Maseru=Africa/Johannesburg
Africa/Mbabane=Africa/Johannesburg
Africa/Mogadishu=Africa/Nairobi
Africa/Niamey=Africa/Lagos
Africa/Nouakchott=Africa/Abidjan
Africa/Ouagadougou=Africa/Abidjan
Africa/Porto-Novo=Africa/Lagos
Africa/Sao_Tome=Africa/Abidjan
Africa/Timbuktu=Africa/Abidjan
America/Anguilla=America/Port_of_Spain
America/Antigua=America/Port_of_Spain
America/Argentina/ComodRivadavia=America/Argentina/Catamarca
America/Aruba=America/Curacao
America/Atka=America/Adak
America/Buenos_Aires=America/Argentina/Buenos_Aires
America/Catamarca=America/Argentina/Catamarca
America/Coral_Harbour=America/Atikokan
America/Cordoba=America/Argentina/Cordoba
America/Dominica=America/Port_of_Spain
America/Ensenada=America/Tijuana
America/Fort_Wayne=America/Indiana/Indianapolis
America/Grenada=America/Port_of_Spain
America/Guadeloupe=America/Port_of_Spain
America/Indianapolis=America/Indiana/Indianapolis
America/Jujuy=America/Argentina/Jujuy
America/Knox_IN=America/Indiana/Knox
America/Kralendijk=America/Curacao
America/Louisville=America/Kentucky/Louisville
America/Lower_Princes=America/Curacao
America/Marigot=America/Port_of_Spain
America/Mendoza=America/Argentina/Mendoza
America/Montreal=America/Toronto
America/Montserrat=America/Port_of_Spain
America/Porto_Acre=America/Rio_Branco
America/Rosario=America/Argentina/Cordoba
America/Shiprock=America/Denver
America/St_Barthelemy=America/Port_of_Spain
America/St_Kitts=America/Port_of_Spain
America/St_Lucia=America/Port_of_Spain
America/St_Thomas=America/Port_of_Spain
America/St_Vincent=America/Port_of_Spain
America/Tortola=America/Port_of_Spain
America/Virgin=America/Port_of_Spain
Antarctica/McMurdo=Pacific/Auckland
Antarctica/South_Pole=Pacific/Auckland
Arctic/Longyearbyen=Europe/Oslo
Asia/Aden=Asia/Riyadh
Asia/Ashkhabad=Asia/Ashgabat
Asia/Bahrain=Asia/Qatar
Asia/Calcutta=Asia/Kolkata
Asia/Chongqing=Asia/Shanghai
Asia/Chungking=Asia/Shanghai
Asia/Dacca=Asia/Dhaka
Asia/Harbin=Asia/Shanghai
Asia/Istanbul=Europe/Istanbul
Asia/Kashgar=Asia/Urumqi
Asia/Katmandu=Asia/Kathmandu
Asia/Kuwait=Asia/Riyadh
Asia/Macao=Asia/Macau
Asia/Muscat=Asia/Dubai
Asia/Phnom_Penh=Asia/Bangkok
Asia/Saigon=Asia/Ho_Chi_Minh
Asia/Tel_Aviv=Asia/Jerusalem
Asia/Thimbu=Asia/Thimphu
Asia/Ujung_Pandang=Asia/Makassar
Asia/Ulan_Bator=Asia/Ulaanbaatar
Asia/Vientiane=Asia/Bangkok
Atlantic/Faeroe=Atlantic/Faroe
Atlantic/Jan_Mayen=Europe/Oslo
Atlantic/St_Helena=Africa/Abidjan
Australia/ACT=Australia/Sydney
Australia/Canberra=Australia/Sydney
Australia/LHI=Australia/Lord_Howe
Australia/NSW=Australia/Sydney
Australia/North=Australia/Darwin
Australia/Queensland=Australia/Brisbane
Australia/South=Australia/Adelaide
Australia/Tasmania=Australia/Hobart
Australia/Victoria=Australia/Melbourne
Australia/West=Australia/Perth
Australia/Yancowinna=Australia/Broken_Hill
Brazil/Acre=America/Rio_Branco
Brazil/DeNoronha=America/Noronha
Brazil/East=America/Sao_Paulo
Brazil/West=America/Manaus
Canada/Atlantic=America/Halifax
Canada/Central=America/Winnipeg
Canada/East-Saskatchewan=America/Regina
Canada/Eastern=America/Toronto
Canada/Mountain=America/Edmonton
Canada/Newfoundland=America/St_Johns
Canada/Pacific=America/Vancouver
Canada/Saskatchewan=America/Regina
Canada/Yukon=America/Whitehorse
Chile/Continental=America/Santiago
Chile/EasterIsland=Pacific/Easter
Cuba=America/Havana
Egypt=Africa/Cairo
Eire=Europe/Dublin
Europe/Belfast=Europe/London
Europe/Bratislava=Europe/Prague
Europe/Busingen=Europe/Zurich
Europe/Guernsey=Europe/London
Europe/Isle_of_Man=Europe/London
Europe/Jersey=Europe/London
Europe/Ljubljana=Europe/Belgrade
Europe/Mariehamn=Europe/Helsinki
Europe/Nicosia=Asia/Nicosia
Europe/Podgorica=Europe/Belgrade
Europe/San_Marino=Europe/Rome
Europe/Sarajevo=Europe/Belgrade
Europe/Skopje=Europe/Belgrade
Europe/Tiraspol=Europe/Chisinau
Europe/Vaduz=Europe/Zurich
Europe/Vatican=Europe/Rome
Europe/Zagreb=Europe/Belgrade
GB=Europe/London
GB-Eire=Europe/London
GMT+0=Etc/GMT
GMT-0=Etc/GMT
GMT0=Etc/GMT
Greenwich=Etc/GMT
Hongkong=Asia/Hong_Kong
Iceland=Atlantic/Reykjavik
Indian/Antananarivo=Africa/Nairobi
Indian/Comoro=Africa/Nairobi
Indian/Mayotte=Africa/Nairobi
Iran=Asia/Tehran
Israel=Asia/Jerusalem
Jamaica=America/Jamaica
Japan=Asia/Tokyo
Kwajalein=Pacific/Kwajalein
Libya=Africa/Tripoli
Mexico/BajaNorte=America/Tijuana
Mexico/BajaSur=America/Mazatlan
Mexico/General=America/Mexico_City
NZ=Pacific/Auckland
NZ-CHAT=Pacific/Chatham
Navajo=America/Denver
PRC=Asia/Shanghai
Pacific/Johnston=Pacific/Honolulu
Pacific/Midway=Pacific/Pago_Pago
Pacific/Ponape=Pacific/Pohnpei
Pacific/Saipan=Pacific/Guam
Pacific/Samoa=Pacific/Pago_Pago
Pacific/Truk=Pacific/Chuuk
Pacific/Yap=Pacific/Chuuk
Poland=Europe/Warsaw
Portugal=Europe/Lisbon
ROC=Asia/Taipei
ROK=Asia/Seoul
Singapore=Asia/Singapore
Turkey=Europe/Istanbul
UCT=Etc/UCT
US/Alaska=America/Anchorage
US/Aleutian=America/Adak
US/Arizona=America/Phoenix
US/Central=America/Chicago
US/East-Indiana=America/Indiana/Indianapolis
US/Eastern=America/New_York
US/Hawaii=Pacific/Honolulu
US/Indiana-Starke=America/Indiana/Knox
US/Michigan=America/Detroit
US/Mountain=America/Denver
US/Pacific=America/Los_Angeles
US/Pacific-New=America/Los_Angeles
US/Samoa=Pacific/Pago_Pago
Universal=Etc/UTC
W-SU=Europe/Moscow
Zulu=Etc/UTC
#Standard (IANA) abbreviations
#Mon Sep 28 16:41:59 WEST 2015
ACWST=Australia/Eucla
AFT=Asia/Kabul
ALMT=Asia/Almaty
ANAT=Asia/Anadyr
AZOST=Atlantic/Azores
AZOT=Atlantic/Azores
AZST=Asia/Baku
AZT=Asia/Baku
BDT=Asia/Dhaka
BNT=Asia/Brunei
BOT=America/La_Paz
BRST=America/Sao_Paulo
BTT=Asia/Thimphu
CAT=Africa/Maputo
CCT=Indian/Cocos
CHADT=Pacific/Chatham
CHAST=Pacific/Chatham
CHOST=Asia/Choibalsan
CHOT=Asia/Choibalsan
CHUT=Pacific/Chuuk
CKT=Pacific/Rarotonga
COT=America/Bogota
CVT=Atlantic/Cape_Verde
CXT=Indian/Christmas
ChST=Pacific/Guam
DAVT=Antarctica/Davis
DDUT=Antarctica/DumontDUrville
EAST=Pacific/Easter
ECT=America/Guayaquil
EGST=America/Scoresbysund
EGT=America/Scoresbysund
FJST=Pacific/Fiji
FJT=Pacific/Fiji
FKST=Atlantic/Stanley
FNT=America/Noronha
GALT=Pacific/Galapagos
GAMT=Pacific/Gambier
GET=Asia/Tbilisi
GFT=America/Cayenne
GILT=Pacific/Tarawa
GYT=America/Guyana
HDT=America/Adak
HKT=Asia/Hong_Kong
HOVST=Asia/Hovd
HOVT=Asia/Hovd
IDT=Asia/Jerusalem
IOT=Indian/Chagos
IRST=Asia/Tehran
JST=Asia/Tokyo
KGT=Asia/Bishkek
KOST=Pacific/Kosrae
LHDT=Australia/Lord_Howe
LHST=Australia/Lord_Howe
LINT=Pacific/Kiritimati
MAGT=Asia/Magadan
MART=Pacific/Marquesas
MAWT=Antarctica/Mawson
MEST=MET
MET=MET
MIST=Antarctica/Macquarie
MMT=Asia/Rangoon
MUT=Indian/Mauritius
MVT=Indian/Maldives
NCT=Pacific/Noumea
NDT=America/St_Johns
NFT=Pacific/Norfolk
NOVT=Asia/Novosibirsk
NPT=Asia/Kathmandu
NRT=Pacific/Nauru
NST=America/St_Johns
NUT=Pacific/Niue
NZDT=Pacific/Auckland
NZST=Pacific/Auckland
OMST=Asia/Omsk
ORAT=Asia/Oral
PET=America/Lima
PETT=Asia/Kamchatka
PGT=Pacific/Port_Moresby
PHOT=Pacific/Enderbury
PHT=Asia/Manila
PKT=Asia/Karachi
PMDT=America/Miquelon
PMST=America/Miquelon
PONT=Pacific/Pohnpei
PWT=Pacific/Palau
PYST=America/Asuncion
PYT=America/Asuncion
QYZT=Asia/Qyzylorda
RET=Indian/Reunion
ROTT=Antarctica/Rothera
SAKT=Asia/Sakhalin
SAMT=Europe/Samara
SAST=Africa/Johannesburg
SBT=Pacific/Guadalcanal
SCT=Indian/Mahe
SGT=Asia/Singapore
SRET=Asia/Srednekolymsk
SRT=America/Paramaribo
SST=Pacific/Pago_Pago
SYOT=Antarctica/Syowa
TAHT=Pacific/Tahiti
TFT=Indian/Kerguelen
TJT=Asia/Dushanbe
TKT=Pacific/Fakaofo
TLT=Asia/Dili
TMT=Asia/Ashgabat
TOT=Pacific/Tongatapu
TVT=Pacific/Funafuti
ULAST=Asia/Ulaanbaatar
ULAT=Asia/Ulaanbaatar
UYT=America/Montevideo
VET=America/Caracas
VOST=Antarctica/Vostok
VUT=Pacific/Efate
WAKT=Pacific/Wake
WAST=Africa/Windhoek
WFT=Pacific/Wallis
WGST=America/Godthab
WGT=America/Godthab
WIT=Asia/Jayapura
WITA=Asia/Makassar
WSDT=Pacific/Apia
WSST=Pacific/Apia
XJT=Asia/Urumqi
YEKT=Asia/Yekaterinburg

以上內容在src\main\resources\com\mysql\cj\jdbc\util.TimeZoneMapping.properties,

= 後面的值為我們可以用來設定的值