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 ...
随机推荐
- maven setting.xml 配置(有效)
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://mav ...
- mysql使用mysqldump 与 mysqlimport进行数据库迁移
1.导入数据库 1)source source /home/platvt/product/pc2_create_tables.sql 2)mysqlimport 使用mysqlimport导入数据: ...
- vue DOM模板解析
当使用 DOM 作为模板时 (例如,使用 el 选项来把 Vue 实例挂载到一个已有内容的元素上),你会受到 HTML 本身的一些限制,因为 Vue 只有在浏览器解析.规范化模板之后才能获取其内容.尤 ...
- ExtJs4学习(一):正确认识ExtJs4
认识ExtJs 1.Javat能用ExtJs吗? 它是展现层的技术,与JS,HTML,CSS有关.至于server端是.Net,还是PHP等无关. 2.ExtJs适合什么样的项目? 依照官方的说法,E ...
- (六)jQuery选择器
jQuery 的选择器可谓之强大无比,这里简单地总结一下常用的元素查找方法: $("#myELement") 选择id值等于myElement的元素,id值不能重复在文档中只能有一 ...
- 利用DataSet部分功能实现网站登录
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- [ 转]C++ 虚函数表解析
http://blog.csdn.net/haoel/article/details/1948051 前言 C++中的虚函数的作用主要是实现了多态的机制.关于多态,简而言之就是用父类型别的指针指向其子 ...
- 笔记本中G-Sensor(加速计) M-Sensor 陀螺仪等传感器的区别
1.G-sensor重力传感器 作用 G-sensor中文是加速度传感器的意思(英文全称是Accelerometer-sensor),它能够感知到加速力的变化,加速力就是当物体在加速过程中作用在物体上 ...
- ALLEGRO修改位号回注ORCAD原理图
资料:ALLEGRO修改位号回注ORCAD原理图 https://wenku.baidu.com/view/54e221e114791711cd7917e2.html?re=view
- jsp获取web.xml 里的配置项
ServletContext servletContext = request.getSession().getServletContext(); String titl ...