springboot 连接 MySQL 运行报错:
The server time zone value '?D1ú±ê*?ê±??' 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.
这个问题: 原因是 MySQL 数据库安装的时候没有将时区选为中国时区 默认是人家美国的 所以出现这个问题 我的原因是我下载的数据库是解压版的 所以也没有更改时区
在这个问题上 网上有很多 我一共解决了几种方式:
MySQL> show global variables like "time_zone";
查看数据库时区 由于我的修改过了 没有修改过 value 这里显示 system
set global variables time_zone '+08:00' 这是时区
另外可以在修改 mini.INI 文件 MySQL 安装目录下
我这里叫 my-default.INI 这个文件 里面添加 default-time-zone='+08:00' 修改设置
但是我这里不知道什么原因上面修改有时候好使 有时候又不好使了
那么我这里又除了上面两种操作外还在项目的 jdbc 连接上 设置了
spring.datasource.url = jdbc:MySQL://localhost:3306/wdksaif?serverTimezone=UTC&characterEncoding=utf-8
最终不报错了.
来源: http://www.bubuko.com/infodetail-2948318.html