【数据库----MySQL】连接MySQL时区错误
问题描述:
MySQL升级到8.0.11之后连接数据库报错:
mysql下载后为啥localhost打不开Your login attempt was not successful, try again.
Reason: Could not get JDBC Connection; nested exception is java.sql.SQLException: 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.
解决⽅式:
从原因中可以看出是时区的问题,两种解决⽅式:
⽅式⼀:修改数据库url
jdbc:mysql://localhost:3306/springsecurity?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
⽅式⼆:修改数据库时区
mysql -hlocalhost -uroot -p
show variables like '%time_zone%'
set global time_zone='+8:00';

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。