出现这个异常的原因是新版8.0的MySQL驱动配置改变了,还会出现以下二个异常如下
1、Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2、java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time
以两个异常解决方案传送门:点我查看
WrongArgumentException: Malformed database URL,failed to parse the main URL sections
异常解决方案如下:
// 1、MySQL新版驱动配置
URL=jdbc:mysql://127.0.0.1:3306/mg?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=UTC
//新版本的MySQL默认的URL地址是127.0.0.1:3306,如果你访问本地的MySQL数据可以这样写
URL=jdbc:mysql:///mg?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=UTC
//使用三个[///代替默认的url地址 ]
//旧的驱动类改成新的驱动类
Driver=com.mysql.cj.jdbc.Driver&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC