连接数据库时,报时区问题,可以修改数据库服务器的时区解决
The server time zone value ‘EDT’ 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.
有以下两种解决方案:
1. 修改数据库连接,添加设置时区的参数
jdbc:mysql://192.168.100.xx0:3x00/spring?serverTimezone=UTC
2. 修改数据库服务器的时区,重启数据库
linux-h017:/home/mysql # ln -s /usr/share//zoneinfo/Asia/Shanghai /etc/localtime
linux-h017:/home/mysql # ls -l /etc/localtime
lrwxrwxrwx 1 root root 34 Aug 25 23:10 /etc/localtime -> /usr/share//zoneinfo/Asia/Shanghai
linux-h017:/home/mysql # date -R
Thu, 25 Aug 2022 23:10:56 +0800
linux-h017:/home/mysql # date +"%Z %z"
CST +0800