Cause: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool

今天从零开始搭建一个springboot项目
服务启动后,发送请求,出现初始化连接池错误

nested exception is org.apache.ibatis.exceptions.PersistenceException: \r\n### Error querying database. Cause: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Communications link failure
Cause: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool_第1张图片
原来是yml文件里数据库的地址写的太简单了

#连接数据库
  datasource:
    #下面四行是  数据源配置
    url: jdbc:mysql://127.0.0.1:3306/test_data
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver

url需要写多点

#连接数据库
  datasource:
    #下面四行是  数据源配置
    url: jdbc:mysql://localhost:3306/test_data?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver

你可能感兴趣的:(mysql,java,apache,spring,boot)