Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我jdbc.properties里的usename写的是root为啥debug queryById的时候报错Access denied for user 'JAY'@'localhost' (using password: YES)。。。我是小白。。 #9

Open
tmlvampire opened this issue Apr 15, 2017 · 11 comments

Comments

@tmlvampire
Copy link

No description provided.

@codingXiaxw
Copy link
Owner

codingXiaxw commented Apr 16, 2017 via email

@tmlvampire
Copy link
Author

数据库我确定是对的 因为不用配置文件的话就连上了。。。。。。用了jdbc,properties就报这个错。。好奇怪

@codingXiaxw
Copy link
Owner

既然能连上那应该不是数据库没打开的缘故,估计是你的spring配置文件中没有将jdbc.properties正确的配置上,再检查下你的resources包下的spring-dao文件试试

@delme-bat
Copy link

spring-dao.xml中,用了${username}之后它好像会取当前计算机用户名来连数据库,spring-dao.xml和jdbc.properties的中username改成user就好使了,希望能帮到你们。

@codingXiaxw
Copy link
Owner

啊哈这种错误我不清楚,不过好像又长了新姿势哈!那使用${username}不能成功连接数据库的建议将参数username换成user试试,谢谢这位小兄弟!

@oldbig-carry
Copy link

亲测有效,spring-dao.xml和jdbc.properties的中username改成user有用,谢谢各位帮忙解决的层主

@leetomlee123
Copy link

不能用username做key

@ericzhanghz
Copy link

mac中应该好的

@chenchuxin
Copy link
Contributor

就是${username}被系统变量覆盖了,不要用username做key即可

@jiangjianpeng
Copy link

你们怎么运行的啊,数据库都没有啊

@ijiroterunao
Copy link

楼上说的都对的,用户名被覆盖了,一般我写jdbc.properties的时候都会加上jdbc. 的前缀,个人认为比较规范。
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants