mybatis用域名连接数据库,出现连接池错误?

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)

我之前改成localhost就行了

现在服务器跟数据库不在一个服务器

只能用域名连接

结果又出现了

图片描述

阅读 3.5k
1 个回答

mysql默认只能本机连接,需要改一下配置文件

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题