application.yml中mysql基础配置

server:
  port: 8080
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource #使用druid数据源,替换C3P0
    url: jdbc:mysql://localhost:3306/blog?useUnicode=true&;characterEncoding=utf-8&;useSSL=true&;serverTimezone=Asia/Shanghai
    username: root
    password: root
    driver-class-name: com.mysql.cj.jdbc.Driver

有时候上面的不能用,用下面的。

jdbc:mysql://localhost:3306/blog-hibernate?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai

你可能感兴趣的:(Spring,Boot,yml)