今天在家用idea进行springboot开发,前面一些坑相对避免了,但是到数据库这块总是连接不上,报错主要是:

Access denied for user 'root'@'localhost' (using password: NO)

网页上显示错误

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sun May 06 15:18:14 CST 2018
There was an unexpected error (type=Internal Server Error, status=500).
nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO) ### The error may exist in file [D:\test\target\classes\mapper\User.xml] ### The error may involve com.example.mapper.UserMapper.getUserById ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)

我检查我的密码等都是正确的,网上各种查,最后,原来是被idea坑了,

根据idea的提示写出来的数据源信息是:


spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test
spring.datasource.data-username=root
spring.datasource.data-password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

这个data-username,data-password,driver-class-name不是jdbc数据源的属性字段,所以不识别,当改为如下设置,数据库就连接上了。

idea开发springboot 的mysql数据库连接问题的更多相关文章

  1. 报表开发工具中mysql数据库连接编码转化失效解决方案

    1. 问题描述 在报表开发工具FineReport中,mysql数据库连接通过数据连接编码转换进行编码的转换,在通过报表录入往数据库中录入中文数据的时候,总是出现乱码,这个该怎么解决呢? 2. 解决方 ...

  2. springboot 使用c3p0数据库连接池

    springboot 使用c3p0数据库连接池的方法  本文转自:http://www.cnblogs.com/xiaosiyuan/p/6255292.html 使用springboot开发时,默认 ...

  3. Mysql数据库连接、查询、记录集操作代码

    Mysql数据库链接代码 function dbConnect($hostname,$username,$pass,$db_name,$pconnect =0) { $func=empty($pcon ...

  4. mysql数据库连接池使用(三)数据库元数据信息反射数据库获取数据库信息

    1.1. mysql数据库连接池使用(三)数据库元数据信息反射数据库获取数据库信息 有时候我们想要获取到数据库的基本信息,当前程序连接的那个数据库,数据库的版本信息,数据库中有哪些表,表中都有什么字段 ...

  5. mysql数据库连接池使用(一)dbcp方式的配置

    Apache的数据库连接池 DBCP的常用配置说明,因为项目中用到了需要对其封装,所以必须先了解怎么配置以及各个配置字段的含义,理解的基础上开发我们自己的数据库连接池.可以参考官网dbcp官网. db ...

  6. node+mysql 数据库连接池

    1. 什么是数据库连接池? 数据库连接池是程序启动时建立足够的数据库连接,并将这些连接组成一个池,由程序动态地对池中的连接进行申请,使用和释放. 2. 使用数据库连接池原理及优点是什么? 数据库连接池 ...

  7. 基于springboot+bootstrap+mysql+redis搭建一套完整的权限架构【六】【引入bootstrap前端框架】

    https://blog.csdn.net/linzhefeng89/article/details/78752658 基于springboot+bootstrap+mysql+redis搭建一套完整 ...

  8. Springboot+Mybatis+MySQL实例练习时踩坑记录

    最近刚开始学习后端,直接让上手学习Springboot+Mybatis+MySQL对CRUD的实例,虽然实例不难,但是上面的三个知识我都不懂,就有点为难我了 所以经常遇到一个点卡自己很久的情况,这里列 ...

  9. SpringBoot15 sell01 项目创建、MySQL数据库连接、日志配置、开发热部署、商品信息模块

    项目软件版本说明: jdk: 1.8 springboot: 2.0.1 mysql: 5.7 1 项目创建 创建一个SpringBoot项目即可,创建是勾选 web jpa mysql 这三个依赖就 ...

随机推荐

  1. centos7一步一步搭建docker nginx 及重点讲解

    系统环境:centos7.7 (VMware中) images版本:nginx:latest (截止2020.01.10最新版) 1.拉取镜像 docker pull nginx 2.启动nginx容 ...

  2. Centos7 设置自定义安装nginx的systemctl启动方式

    一.systemctl方式启动设置过程 1.首先创建服务配置文件(名字和路径就是这个) vim /usr/lib/systemd/system/nginx.service 2.添加配置内容 [Unit ...

  3. golang自定义error

    系统自身的error处理一般是 errors.New()或fmt.Errorf()等,对一些需要复杂显示的,不太友好,我们可以扩展下error. error在标准库中被定义为一个接口类型,该接口只有一 ...

  4. html弹出框播放视频

    <a data-toggle="modal" data-target=".bs-example-modal-lg">模态框</a> &l ...

  5. Java 5 、6、 7中新特性

    JDK5新特性(与1.4相比)[转] 1 循环 for (type variable : array){ body} for (type variable : arrayList){body} 而1. ...

  6. monkey常见API及实例

    一.API简介 LaunchActivity(pkg_name, cl_name):启动应用的Activity.参数:包名和启动的Activity. Tap(x, y, tapDuration): 模 ...

  7. 解决 /actuator/beans不能访问

    在Spring Boot中配置了actuator,能够访问到/actuator/health,但是在访问/actuator/beans的时候却显示如下404错误. 原因是 /actuator/heal ...

  8. Android将数据存储到应用的数据目录下

    下面是具体代码,其中MainActivity.java的部分代码有修改,在文章后面给出 logindemo_layout.java <?xml version="1.0" e ...

  9. arm linux 移植 rsync

    背景: 在产品开发中可以使用rsync进行大文件的拷贝,断点续传. host平台 :Ubuntu 16.04 arm平台 : 3531d   rsync   :3.1.3 arm-gcc :4.9.4 ...

  10. WorkerServices构建Windows服务

    .NET Core 3.1和WorkerServices构建Windows服务 介绍 ASP.NET Core 3增加了一个非常有意思的功能Worker Service.他是一个ASP.NET Cor ...