问答详情
源自:6-1 关于红包收发之操作数据库(上)

数据库问题

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_121]

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_121]

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_121]

at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_121]


提问者:你是我的小可爱 2019-11-22 18:40

个回答

  • 慕九州8576440
    2020-02-07 09:47:04

    我能正常启动,但是没有生成表。大哥碰见过这个问题吗

    2020-02-07 09:42:09.125  INFO 9824 --- [           main] c.i.luckymoney.LuckymoneyApplication     : Starting LuckymoneyApplication on v_rslv-NB2 with PID 9824 (D:\softwore\Idea\Project\luckymoney\target\classes started by v_rslv in D:\softwore\Idea\Project\luckymoney)

    2020-02-07 09:42:09.128  INFO 9824 --- [           main] c.i.luckymoney.LuckymoneyApplication     : The following profiles are active: dev

    2020-02-07 09:42:09.946  INFO 9824 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)

    2020-02-07 09:42:09.960  INFO 9824 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

    2020-02-07 09:42:09.960  INFO 9824 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.16]

    2020-02-07 09:42:09.965  INFO 9824 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_191\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.8.0_191;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp;D:\softwore\Anaconda;D:\softwore\Anaconda\Library\mingw-w64\bin;D:\softwore\Anaconda\Library\usr\bin;D:\softwore\Anaconda\Library\bin;D:\softwore\Anaconda\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\softwore\MATLAB\runtime\win64;D:\softwore\MATLAB\bin;D:\softwore\Python36\Scripts;D:\softwore\Python36;D:\softwore\Node\;C:\Users\v_rslv\AppData\Roaming\npm\node_modules\npm;D:\softwore\Go\bin;D:\softwore\Git\Git\cmd;C:\Program Files\Java\jdk1.8.0_191\bin;C:\Program Files\Java\jre1.8.0_191\bin;C:\Program Files\MySQL\MySQL Server 5.7\bin;D:\softwore\Maven\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;D:\softwore\Python36\Scripts\;D:\softwore\Python36\;C:\Users\v_rslv\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Java;C:\Users\v_rslv\AppData\Roaming\npm;D:\softwore\VScode\Microsoft VS Code\bin;C:\Users\v_rslv\go\bin;D:\softwore\SSH secure shell client;D:\softwore\Idea\IntelliJ IDEA 2019.3.2\bin;;.]

    2020-02-07 09:42:10.097  INFO 9824 --- [           main] o.a.c.c.C.[.[localhost].[/luckymoney]    : Initializing Spring embedded WebApplicationContext

    2020-02-07 09:42:10.097  INFO 9824 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 940 ms

    2020-02-07 09:42:10.258  INFO 9824 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'

    2020-02-07 09:42:10.403  INFO 9824 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path '/luckymoney'

    2020-02-07 09:42:10.405  INFO 9824 --- [           main] c.i.luckymoney.LuckymoneyApplication     : Started LuckymoneyApplication in 1.587 seconds (JVM running for 2.372)


  • qq_慕的地8462048
    2020-02-05 18:45:49

    该问题是MySql本身的时区设置的问题导致的,MySql安装默认设置为美国时区,而北京时间比美国迟8小时


  • 皮卡乒乓
    2020-01-28 00:08:42


    url: jdbc:mysql://127.0.0.1:3306/luckymoney?serverTimezone=Asia/Shanghai

    UTC是全球标准时间

    保证MySQL和JAVA插入的时区一致应该就行


  • Focuxin
    2020-01-15 17:07:38

    我也是这个问题,感谢

  • 你是我的小可爱
    2019-11-22 18:46:00

    serverTimezone=UTC?网上查找后确实有用,但是不明白为什么会出现这个问题