Spring Boot连接MySQL报错“Internal Server Error”的解决办法

报错信息如下:

{timestamp: "2018-06-14T03:48:23.436+0000", status: 500, error: "Internal Server Error",…}
error
:
"Internal Server Error"
message
:
"Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: 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."
path
:
"/user/userList"
status
:
500
timestamp
:
"2018-06-14T03:48:23.436+0000"

解决办法:

spring.datasource.url对应的URL后面加?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8

例:

spring.datasource.url=jdbc:mysql://localhost:3306/zifeiydb?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8

完整的一个application.properties例子:

# DB Configuration
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/zifeiydb?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=password
# logging
logging.level.com.zifeiy.demo=debug

原文地址:https://www.cnblogs.com/zifeiy/p/9182414.html

时间: 2024-10-10 20:23:07

Spring Boot连接MySQL报错“Internal Server Error”的解决办法的相关文章

连接mysql报错 : The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone...

time zone 时区错误 DBEAVER连接MySQL运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone... 使用root用户登录mysql,执行以下语句 show variables like '%time_zone%'; 执行结果是这样的: SYSTEM为SQL默认美国时间,而我们中国要比他们迟8小时 因此将时区设置为当前系统时区即可,所以

PHP7 上传文件报错 Internal Server Error解决方法

上传文件的时候总是提示Internal Server Error错误.错误如下: Internal Server Error 检查Apache的错误日志.Apache/logs/error_log 错误信息为 mod_fcgid: HTTP request length 139072 (so far) exceeds MaxRequestLen (131072) 该错误是上传文件过大,需要修改Apache 和PHP的配置文件的upload上传文件大小 修改您的php.ini内 upload_ma

Cobbler 登录web界面提示报错“Internal Server Error”

在访问cobbler web界面到时候出现以下提示 ssl的报错日志如下: [[email protected] ~]# tail -f /var/log/httpd/ssl_error_log [Mon Jan 07 16:24:53.363029 2019] [:error] [pid 3383] [remote 10.0.0.1:212] mod = importlib.import_module(self.SETTINGS_MODULE) [Mon Jan 07 16:24:53.363

Linux 报错:syntax error "C" 解决办法(此处选择bash系统)

出现此问题的原因,是由系统的兼容性引起的,linux下默认了指向dash而非bash. linux下Dash改Bash: 1.先查看是使用哪个shell ls -al /bin/sh 2.#如果是Dash可以用以下方法切回bash(选择NO) 方法一:sudo dpkg-reconfigure  dash 方法二:sudo ln-fs  /bin/bash   /bin/sh (感谢其他的前辈,这是之前从网上查找后,自己做的笔记,自己整理出来,作为我的成长之路的经历,写此博客是为了记录自己出现过

连接mysql报错java.sql.SQLException: The server time zone value '?й???????' is unrecognized...解决方法

报错内容: 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

连接mysql报错:error 2003 (hy000):can't connect to mysql server on 'localhost' (10061)

一.mysql 的bin目录下有个MySQLInstanceConfig.exe,运行就可以进行创建数据库实例,创建实例时也可以生成windows 服务,把服务设置成自动启动就可以了 二.安装在D盘的discuzz!打开后出现上述错误,请问应如何处理?winmysqladmin已经启动,但三色树上有一个小红点如果出现"ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)",说明你的MySQL还没有启动.解决办法

PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2)

如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2) 测试代码如下: <?php try { $dsn = 'mysql:dbname=php-note;host=localhost;port=3306;charset=utf8'; $username = 'root'; $password = 'root'; new PDO( $dsn,

1130 - Host&#39;xxx.xxx.xxx.xxx&#39; is not allowed to connect to this MySQL server解决Navicat连接MySQL报错

最近使用Navicat for MySQl访问远程mysql数据库,出现报错,显示"1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server".解决办法如下: 方法/步骤 首先看报错窗口. 经查阅,错误原因是:本地IP(xxx.xxx.xxx.xxx)没有访问远程数据库的权限. 于是下面开启本地IP(xxx.xxx.xxx.xxx)对远程mysql数据库的访问权限. 首先远程连接进入服务器,在

用Navicat连接mysql报错:2003-Can&#39;t connect to MySql server on &#39;10.100.0.109&#39;(10039)

问题描述 在 window 系统上,用 Navicat 连接 Mysql 数据库,弹出以下提示 问题原因  Mysql 数据库未启动 解决方案:启动 Mysql 数据库 1.点击桌面左下角运行 cmd,然后回车 2.输入命令:services.msc,然后回车,弹出服务页面 3.在服务页面找到 MySQL服务,查看状态,如果未启动,就启动服务 用Navicat连接mysql报错:2003-Can't connect to MySql server on '10.100.0.109'(10039)