当前位置:首页 > mysql > 正文内容

You must configure either the server or JDBC driver (via the serverTimezone configuration property)

关中浪子2年前 (2022-03-30)mysql1059
【腾讯云】2核2G4M云服务器新老同享99元/年,续费同价
找梯子最重要的就是稳定,这个已经上线三年了,一直稳定没有被封过,赶紧下载备用吧!

错误提示:

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: 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.

 

 

解决办法;

 

在连接字符串后面加上?serverTimezone=UTC


其中UTC是统一标准世界时间。


完整的连接字符串示例:jdbc:mysql://localhost:3306/test?serverTimezone=UTC


或者还有另一种选择:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8,这个是解决中文乱码输入问题,当然也可以和上面的一起结合:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC


扫描二维码推送至手机访问。

版权声明:本文由码农翻生发布,如需转载请注明出处。

本文链接:https://lubojian.cn/post/157.html

分享给朋友:

相关文章

MySQL Index的使用

一、什么是索引?  索引用来快速地寻找那些具有特定值的记录,所有MySQL索引都以B-树的形式保存。如果没有索引,执行查询时MySQL必须从第一个记录开始扫描整个表的所有记录,直至找到符合要求的记录。表里面的记录数量越多,这个操作的代价就越...

windows mysql-installer-community-8.0.19.0.msi  社区版 windows service安装教程

windows mysql-installer-community-8.0.19.0.msi 社区版 windows service安装教程

一、下载MySQL登录MySQL官网下载MSI Installer:点击“Dnownload”点击“No thanks, just start my download.”二、安装MySQLStep1:选择安装类型根据个人需求,选择其中一个安...

创建mysql 数据库命令 指定编码

GBK:create database   test  DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;UTF8:CREATE DATABASE test&nb...

DBeaver  mysql   Public Key Retrieval is not allowed

DBeaver mysql Public Key Retrieval is not allowed

@[TOC]DBeaver连接mysql时Public Key Retrieval is not allowed错误解决附图片问题Public Key Retrieval is not allowed解决在新建连接的时候,驱动属性里设置 a...

mysql 8.0 和 mysql5.7配置文件修改sql_mode的方法

MySQL5.7:在MySQL配置文件中 my.ini    在[mysqld]标签里新增或修改:sql_mode = NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION重启MySQL。...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。