java.sql.SQLException: Access denied for user 'somebody'@'localhost'
来源:互联网 发布:电脑应用无法链接网络 编辑:程序博客网 时间:2024/06/05 20:04
我是在IntelliJ IDEA上整合Mybatis和Spring的,运行测试用例出现了如标题所示的错误。
问题是,我的数据库里面没有以我名字为用户名的用户。而只有IntelliJIDEA是用我的名字授权的,难道和这个有关?
网上搜了很多类似的错误处理方法,发现对我的情况没有用。
最后我在mysql中创建了一个我名字的用户。然后把数据库配置文件中的用户名和密码改成我的用户名密码,居然可以了。
现在是可以使用整合的框架测试了。
问题了来了。当我新建一个test用户后,把数据库配置文件改成test用户的信息,还是报上图的错。所以。。。我是不能改其他用户了?
我试过用管理员身份(电脑是win10系统,考虑可能权限要求高)打开IntelliJIDEA,然并卵,还是只能登我的账户密码。。。
知道解决方案了,现在可以配置任意我想要的用户名
原先是这样配置数据库连接信息的:
1
2
3
4
driver=com.mysql.jdbc.Driver
url=jdbc:mysql:
//localhost
:3306
/XXXX
?useUnicode=true
&characterEncoding=utf8
username=root
password=root
改成这样就可以了:
1
2
3
4
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql:
//localhost
:3306
/XXXX
?useUnicode=
true
&characterEncoding=utf8
jdbc.username=root
jdbc.password=root
新的发现,改成这样也可以:
1
2
3
4
driver=com.mysql.jdbc.Driver
url=jdbc:mysql:
//localhost
:3306
/seckill
?useUnicode=
true
&characterEncoding=utf8
user=root
password=root
只要不写成username好像都可以,username这个变量好像被jvm环境占用了
阅读全文
0 0
- java.sql.SQLException: Access denied for user 'somebody'@'localhost'
- java.sql.SQLException: Access denied for user 'root'@'localhost'
- java.sql.SQLException: Access denied for user 'root'@'localhost'
- java.sql.SQLException: Access denied for user 'root'@'localhost'
- java.sql.SQLException: Access denied for user
- java连接mysql数据库java.sql.SQLException: Access denied for user 'root'@'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' (using password: YES)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)的一种解决方法
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- 解决:java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)的一种解决方法
- 错误java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- Android Gradle Build Error:Some file crunching failed, see logs for details解决办法
- Linux防火墙之具有命令行的FirewallD的基本操作
- 浅谈正则表达式
- STM32F4学习笔记01——ADC
- Android studio 3.0创建项目后,编译出错解决
- java.sql.SQLException: Access denied for user 'somebody'@'localhost'
- 车牌识别无感支付是什么?
- jsp标签的用法
- session的一些常用方法
- 2017.07.01 上午咨询总结
- 【React Native】React Native之Could not get BatchedBridge,make sure...的问题
- 文章标题
- 八大排序算法(4) 堆排序
- poj 1149网络流建模(转载自Edelweiss代码自己编的有点丑陋0 0)