java.sql.sql异常:用户“asus”@“localhost”的访问被拒绝(使用密码:YES)
java.sql.SQLException: Access denied for user 'asus'@'localhost' (using password: YES)
在整合ssm框架是出现错误java.sql.SQLException: Access denied for user 'asus'@'localhost' (using password: YES),经反复百度以及修改后,我的错误解决了,如下:
原本的数据库配置文件:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/ssmbuilder?useSSL=true&useUnicode=true&characterEncoding=utf8
username=root
password=123456
spring连接数据库代码
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driver}"/>
<property name="jdbcUrl" value="${url}"/>
<property name="user" value="${username}"/>
<property name="password" value="${password}"/>
</bean>
经反复尝试后,将username该为user解决,我也不知道为啥
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/ssmbuilder?useSSL=true&useUnicode=true&characterEncoding=utf8
user=root
password=123456
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driver}"/>
<property name="jdbcUrl" value="${url}"/>
<property name="user" value="${user}"/>
<property name="password" value="${password}"/>
</bean>