本文共 859 字,大约阅读时间需要 2 分钟。
在配置数据库连接信息(jdbc.properties文件)时跟着老师的编码走的,如下:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=utf8
username=root
password=464648
但是居然报错了:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root '@'localhost' (using password: YES))
### The error may exist in mapper/CustomerMapper.xml
### The error may involve com.zhexiang.mybatis_springmvc.model.selectCustomerByID
### The error occurred while executing a query
后来百度了一下,在以上的配置中需要写成如下形式,有哪位同学知道具体原因么?
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=
转载地址:https://blog.csdn.net/weixin_33572836/article/details/114624590 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!