具体报错如下:
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后加上?serverTimezone=UTC&characterEncoding=utf-8,同时解决了时区差异报错和输入中文报错。
例子:"jdbc:mysql://localhost:3306/app?serverTimezone=UTC&characterEncoding=utf-8"
本文介绍了解决在连接MySQL数据库时遇到的时区差异和中文输入错误的方法。通过在数据库URL中添加特定参数,如serverTimezone和characterEncoding,可以有效避免这些问题。
880

被折叠的 条评论
为什么被折叠?



