错误信息
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
java.sql.SQLException: Connections could not be acquired from the underlying database!
com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
java.sql.SQLException: null, message from server: “Host ‘hubble’ is not allowed to connect to this MySQL server”
原因
没有连接到数据库
解决办法
方法一
修改数据库的连接地址为 localhost
jdbc:mysql://localhost:3306/
方法二
修改数据库中允许的连接方式, 执行一下语句
use mysql;
-- 查看允许的连接方式
select host,user from user;
-- 修改允许的连接方式
update user set host='%' where user='root';