当时我出现这个错误时,是因为我的配置文件application.properties ,配置数据库那一块书写有错误(用的是spring boot)
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxx
spring.datasource.username=xxx
spring.datasource.password=xxxxxx
spring.datasource.driverClassName=com.mysql.jdbc.Driver
要是配置没有错误的话,可以试着重启一下数据库