解决springboot项目启动时提示mysql时区无法识别的问题

springboot mysql数据库操作实例

启动项目时,出现如下报错:

The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 

解决方案:

使用root用户后台登录mysql数据库:

>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2109
Server version: 5.7.22-log MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like '%time_zone%';

mysql> set global time_zone='+8:00';

退出后,重新登录数据库查询时区,即更正成功。

重启springboot项目后,启动成功。

登录数据库,查询创建的实体表person。

person表创建成功。

查看person表结构:

猜你喜欢

转载自www.cnblogs.com/staring0815/p/10362525.html