用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)的更多相关文章

  1. java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)

    在更新项目之后,做了一定的改动后发现竟然报错了,刚才还好好的. java.sql.SQLException: Access denied for user 'root'@'localhost' (us ...

  2. 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 ...

  3. 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: ...

  4. Error updating database. Cause: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)

    导入别人的项目,出现一个错误,经过排查,是db.properties配置文件中的用户名与Mybatis-conf.xml配置文件中调用的用户名不一致所导致的 (db.properties中用的是nam ...

  5. 技术笔记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 ...

  6. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using password: YES)

    今天用eclipse连接一下数据库,出现此异常. java.sql.SQLException: Access denied for user 'scott'@'localhost' (using pa ...

  7. java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 解决办法

    一.背景 在Spark中,将DStream写入到MySQL出现错误:java.sql.SQLException: Access denied for user 'root'@'localhost' ( ...

  8. [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 ...

  9. java.sql.SQLException: Access denied for user 'roo'@'localhost' (using password: YES)

    初学mysql,安装了mysql8.0.11,激动的用jdbc连接数据库,出现error,折腾了三天依旧无解,最后无奈装了比较稳定的mysql5.5,问题得以解决,很迷,但只要error没了就开心. ...

  10. 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 ...

随机推荐

  1. Python 第三方 http 库-Requests 学习

    Requests 是用Python语言编写,基于 urllib,采用 Apache2 Licensed 开源协议的 HTTP 库.它比 urllib 更加方便,可以节约我们大量的工作,完全满足 HTT ...

  2. C语言之基本算法32—鞍点

    //数组 /* ================================================================== 题目:求随意矩阵的全部鞍点.并统计个数.(在矩阵中 ...

  3. 自己定义字体之BMFont的使用

    ***************************************转载请注明出处:http://blog.csdn.net/lttree************************** ...

  4. GitHub上编程语言流行度分析

    GitHub已然是全球最流行的开源项目托管平台,项目数量眼下已经达到了千万级别.Adereth在Counting Stars on GitHub一文提供了一个很有意思的思路,那就是籍GitHub用户通 ...

  5. VESA-ADV7123-SOCKIT-DE2115

    /*--VGA Timing--Horizontal :-- ______________ _____________-- | | |--_______________| VIDEO |_______ ...

  6. zabbix-agent active 配置自动探测

    1. zabbix-agent 被动模式配置文件: PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_a ...

  7. Socket的UDP协议在erlang中的实现

    现在我们看看UDP协议(User Datagram Protocol,用户数据报协议).使用UDP,互联网上的机器之间可以互相发送小段的数据,叫做数据报.UDP数据报是不可靠的,这意味着如果客户端发送 ...

  8. Ubuntu/CentOS下源码编译安装Php 5.6基本参数

    先确认安装libxml2 apt-get install libxml2 libxml2-dev或者yum install libxml2 libxml2-dev ./configure --pref ...

  9. hunnu--11548--找啊找啊找朋友

    找啊找啊找朋友 Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB Total submit users: 14,  ...

  10. [python学习] 简单爬取图片站点图库中图片

    近期老师让学习Python与维基百科相关的知识,无聊之中用Python简单做了个爬取"游讯网图库"中的图片,由于每次点击下一张感觉很浪费时间又繁琐.主要分享的是怎样爬取HTML的知 ...