zoukankan      html  css  js  c++  java
  • springboot中数据库的连接

    mysql5.0

    1、#mysql数据库连接
    2、spring.datasource.driver-class-name=com.mysql.jdbc.Driver
     
    3、spring.datasource.url=jdbc:mysql://localhost:3306xxxx
     
    4、spring.datasource.username=root
     
    5、spring.datasource.password=123456
     
    mysql8.0
    1、spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
     
    2、spring.datasource.url=jdbc:mysql://localhost:3306/xxxx?serverTimezone=GMT%2B8
     
    3、spring.datasource.username=root
     
    4、spring.datasource.password=123456
     

    注意:

    1、这里的 url 使用了 ?serverTimezone=GMT%2B8 后缀,因为Spring Boot 2.1 集成了 8.0版本的jdbc驱动,这个版本的 jdbc 驱动需要添加这个后缀,否则运行测试用例报告如下错误:

    java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more 

    2、这里的 driver-class-name 使用了  com.mysql.cj.jdbc.Driver ,在 jdbc 8 中 建议使用这个驱动,之前的 com.mysql.jdbc.Driver 已经被废弃,否则运行测试用例的时候会有 WARN 信息

  • 相关阅读:
    RSA
    antd 规则检查
    antd 使用总结问题
    react context prop-types
    【CSS/JS】如何实现单行/多行文本溢出的省略(...)
    react prop-types
    js 监听URL的hash变化
    Spark 读取Hadoop集群文件
    HIVE 常见函数
    Linux ANSI转 UTF8
  • 原文地址:https://www.cnblogs.com/HezhenbinGoGo/p/13426391.html
Copyright © 2011-2022 走看看