Giter Site home page Giter Site logo

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

codingxiaxw avatar codingxiaxw commented on August 19, 2024
我jdbc.properties里的usename写的是root为啥debug queryById的时候报错Access denied for user 'JAY'@'localhost' (using password: YES)。。。我是小白。。

from seckill.

Comments (11)

ijiroterunao avatar ijiroterunao commented on August 19, 2024 1

楼上说的都对的,用户名被覆盖了,一般我写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

from seckill.

codingXiaxw avatar codingXiaxw commented on August 19, 2024

from seckill.

tmlvampire avatar tmlvampire commented on August 19, 2024

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

from seckill.

codingXiaxw avatar codingXiaxw commented on August 19, 2024

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

from seckill.

delme-bat avatar delme-bat commented on August 19, 2024

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

from seckill.

codingXiaxw avatar codingXiaxw commented on August 19, 2024

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

from seckill.

oldbig-carry avatar oldbig-carry commented on August 19, 2024

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

from seckill.

leetomlee123 avatar leetomlee123 commented on August 19, 2024

不能用username做key

from seckill.

ericzhanghz avatar ericzhanghz commented on August 19, 2024

mac中应该好的

from seckill.

chenchuxin avatar chenchuxin commented on August 19, 2024

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

from seckill.

jiangjianpeng avatar jiangjianpeng commented on August 19, 2024

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

from seckill.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.