超详解The server time zone value ‘�й���ʱ��‘ is unrecognized or represents more than one time zone
1.问题分析
2.解决方案
使用的数据库是MySQL,驱动是8.0.22,
这是由于数据库和系统时区差异所造成的,MySQL8以上的驱动要求声明时区,
在jdbc连接的url后面加上serverTimezone=GMT即可解决问题,
如果需要使用gmt+8时区,需要写成GMT%2B8,否则会被解析为空。
再一个解决办法就是使用低版本的MySQL jdbc驱动,5.1.49不会存在时区的问题。
3.使用低版本Mysql驱动警告分析
在将版本修改为5.1.49(或者其他的低版本Mysql驱动)后,会出现警告:
Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果未设置显式选项,则默认情况下必须建立SSL连接。为了符合不使用SSL的现有应用程序,verifyServerCertificate属性设置为“false”。您需要通过设置useSSL=false显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任库。
对此,我们可以在配置spring.datasource.url时,可以在url后面加上 useSSL=false
3.总结
使用不同的数据库驱动版本可能会导致数据库和系统时区差异,或者低版本的警告。
动版本可能会导致数据库和系统时区差异,或者低版本的警告。
在使用数据库驱动版本时要充分考虑,结合需求去使用。
相关文章
- 【Windows】Windows10 企业版 LTSC/Windows Server 2019如何安装应用商店和UWP应用?
- SVN Server配置详解 及备份
- The server has either erred or is incapable of performing the requested operation. (HTTP 500)
- 【k8s】访问 api-server
- ERROR 2003 (HY000): Can't connect to MySQL server on '129.28.149.240' (111) mysql 无法远程连接
- Vue项目碰到"‘webpack-dev-server’报错问题
- Sql Server ROW_NUMBER、RANK等排名函数小结
- 第73课内幕资料详细版 Spark SQL Thrift Server 实战 每天晚上20:00YY频道现场授课频道68917580
- 我们采访了阿里云云数据库SQL Server的产品经理,他说了解这四个问题就可以了
- Sql Server数据库自增长字段标识列的插入或更新修改操作办法
- (总结)CentOS Linux下VNC Server远程桌面配置详解
- 《SQL Server 2005开发技术大全》分享一本书
- 【转载】Windows Server 2008 计划任务配置(任务计划程序)每分钟执行BAT
- MyCat配置文件详解--server.xml
- 一种快速统计SQL Server每个表行数的方法