当前位置:   article > 正文

项目报错:java.sql.SQLNonTransientConnectionException: Could not create connection to database server

java.sql.sqlnontransientconnectionexception: could not create connection to

1.启动导入项目(黑马品达权限控制)时报错java.sql.SQLNonTransientConnectionException: Could not create connection to database server
2.解决方案:将mysql的maven依赖版本改为mysql版本,并记得刷新maven配置哦。
在这里插入图片描述
3.其他可能的原因:mysql版本与mysql驱动,mysql8.x需要在url加入时区

spring:
  datasource:
    druid:
      username: root
      password: 123456
      driver-class-name: com.mysql.cj.jdbc.Driver #mysql8.x
                       # com.mysql.jdbc.Driver     mysql5.x
      url: jdbc:mysql://127.0.0.1:3306/pd_auth?serverTimezone=GMT%2B8&characterEncoding=utf8&useUnicode=true&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号