zoukankan      html  css  js  c++  java
  • spring boot连接mysql8出现连接不上问题

    Mysql8.0接入Spring Boot项目中的问题:

    第一步:在Spring Boot中,默认是连接MySQL5的配置,需要在Pom.xml文件中添加配置MySQL8:

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.15</version>
    </dependency>

    第二步:要换成新的驱动程序类, com.mysql.cj.jdbc.Driver;    注意:驱动程序类前后都不要出现  空格  否则会出现连接错误的问题;

    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    spring.datasource.url=jdbc:mysql://localhost:3306/springboot?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
    spring.datasource.username=root
    spring.datasource.password=myroot

    数据库连接的基本配置:数据库名、账号、密码、连接池等确认是否正确;

  • 相关阅读:
    SpringBoot 整合Shiro
    Shiro 学习
    SpringBoot 整合security、thymeleaf
    【SpringBoot__Mybatis】整合MyBatis 配置文件版2
    SpringBoot 配置Druid数据源及监控
    lombok 使用
    thymeleaf 常用
    随机模块
    md5加密
    python正则
  • 原文地址:https://www.cnblogs.com/abcdjava/p/11262330.html
Copyright © 2011-2022 走看看