java.sql.SQLException: Access denied for user 'somebody'@'localhost' (using password: YES)
用mybatis和spring整合时出现了一个错误:

我是在IntelliJ IDEA上整合Mybatis和Spring的,运行测试用例出现了如上错误。
红色的马赛克部分是我的名字。
问题是,我的数据库里面没有以我名字为用户名的用户。而只有IntelliJIDEA是用我的名字授权的,难道和这个有关?
网上搜了很多类似的错误处理方法,发现对我的情况没有用。
最后我在mysql中创建了一个我名字的用户。然后把数据库配置文件中的用户名和密码改成我的用户名密码,居然可以了。
现在是可以使用整合的框架测试了。
问题了来了。当我新建一个test用户后,把数据库配置文件改成test用户的信息,还是报上图的错。所以。。。我是不能改其他用户了?
我试过用管理员身份(电脑是win10系统,考虑可能权限要求高)打开IntelliJIDEA,然并卵,还是只能登我的账户密码。。。
知道解决方案了,现在可以配置任意我想要的用户名
原先是这样配置数据库连接信息的:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf8
username=root
password=root
改成这样就可以了:
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=root
新的发现,改成这样也可以:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf8
user=root
password=root
只要不写成username好像都可以,username这个变量好像被jvm环境占用了
java.sql.SQLException: Access denied for user 'somebody'@'localhost' (using password: YES)的更多相关文章
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
在更新项目之后,做了一定的改动后发现竟然报错了,刚才还好好的. java.sql.SQLException: Access denied for user 'root'@'localhost' (us ...
- java.sql.SQLException: Access denied for user 'sa'@'localhost' (using password: YES)
1.错误描述 ERROR:2015-05-01 23:43:04[localhost-startStop-1] - HHH000319: Could not get database metadata ...
- java.sql.SQLException: Access denied for user 'sa'@'localhost' (using password: NO)
1.错误描述 INFO:2015-05-01 16:53:29[main] - HHH000228: Running hbm2ddl schema update INFO:2015-05-01 16: ...
- Error updating database. Cause: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)
导入别人的项目,出现一个错误,经过排查,是db.properties配置文件中的用户名与Mybatis-conf.xml配置文件中调用的用户名不一致所导致的 (db.properties中用的是nam ...
- 技术笔记1:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password)
在myEclipse10中运行java项目的时候,遇到java.sql.SQLException: Access denied for user 'root'@'localhost' (using p ...
- java.sql.SQLException: Access denied for user 'scott'@'localhost' (using password: YES)
今天用eclipse连接一下数据库,出现此异常. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using pa ...
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 解决办法
一.背景 在Spark中,将DStream写入到MySQL出现错误:java.sql.SQLException: Access denied for user 'root'@'localhost' ( ...
- [Spring MVC - 2A] - java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
严重: Servlet.service() for servlet [springMVC] in context with path [/ExceptionManageSystem] threw ex ...
- java.sql.SQLException: Access denied for user 'roo'@'localhost' (using password: YES)
初学mysql,安装了mysql8.0.11,激动的用jdbc连接数据库,出现error,折腾了三天依旧无解,最后无奈装了比较稳定的mysql5.5,问题得以解决,很迷,但只要error没了就开心. ...
- java.sql.SQLException: Access denied for user 'Administrator'@'localhost' (using password: YES)
早上在做MyBatis+Spring整合的时候爆了个奇葩的bug: 十月 19, 2017 11:18:11 上午 org.springframework.context.support.Abstra ...
随机推荐
- xml 文件不给提示(以mybatis 的 mapper映射文件为例)
在xxx.xml 映射文件的头部可以看到 如下: (mybatis generate 自动生成) <!DOCTYPE mapper PUBLIC "-//mybatis.org//DT ...
- 值得推荐的android开发框架简单介绍
一些总结出来的Android高速开发框架,所有都是开源框架,附带项目地址,是开发学习的绝佳资料. Direct-Load-apk项目 项目主页地址:http://www.kymjs.com/ 功能:D ...
- apache压缩页面, 全面加速网站
介绍: 网页压缩来进一步提升网页的浏览速度,它完全不需要任何的成本,只不过是会让您的服务器CPU占用率稍微提升一两个百分点而已或者更少. 原理: 网页压缩是一项由 WEB 服务器和浏览器之间共 ...
- 03_Nginx加入新模块
1 进入nginx安装文件夹,查看nginx版本号及其编译參数: [root@localhost nginx]# ./nginx -V nginx version: nginx/1.8.0 bu ...
- MySQL之慢查询-删除慢查询日志
一.环境 OS:CentOS release 5.8(64位) DB:MySQL5.5.17 二.操作 直接通过命令 rm -f 删除了慢查询日志 三.出现故障 慢查询日志没有自己主 ...
- OpenReadWithHttps
///<summary>///采用https协议访问网络///</summary>///<param name="URL">url地址</ ...
- iOS 瀑布流封装
代码地址如下:http://www.demodashi.com/demo/12284.html 一.效果预览 功能描述:WSLWaterFlowLayout 是在继承于UICollectionView ...
- cnBlogs windows LIves Writes 安装
1. 官网下载安装 http://group.cnblogs.com/topic/8550.html 参照这个网址下载并安装软件,顺利的话,就万事大吉.但是,如果报错的话,比如我出现的报错的代码是 ...
- freemark2pdf
freemarker+ITextRenderer 生成html转pdf 博客分类: ITextRenderer ITextRenderer 网上已经有比较多的例子 写这个 但是很多都是简单的 dem ...
- Dell 刀片服务器CentOS6.5mini开机20~30分钟宕机
今天查看系统日志发现大量的nf_conntrack: table full, dropping packet. 错误 cat /var/log/messages | moreJun 7 09:52: ...