MySQL数据库从5.0到8.0URL需改变
今天重新安装系统,所以数据库也重新安装了,从原来的5.X 变成了8.X 出现了好多问题。在这里记录一下
出现The server time zone value 'Öйú±ê׼ʱ¼ä'
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是统一标准世界时间。
项目启动过程中出现Establishing SSL connection without server's identity verification is not recommended.
解决办法:
url中添加useSSL=true
Mysql 8.0版本用新的驱动com.mysql.cj.jdbc.Driver
最终的URL为
url=jdbc:mysql://localhost:3306/ugrow?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false
用SpringBoot时配置文件为properties格式文件用&连接
用Spring配置文件为xml格式 需要将&改成&