会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132885个问题
JAVA 全系列/第三阶段:数据库编程/JDBC技术 19353楼
Python 全系列/第一阶段:Python入门/控制语句 19354楼

老师你好,之前Mybatisdemo时也有这个报警,是个重复问题。查了资料,是MySQL密码问题,密码我用了正确。

Caused by: java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES)

报警:

<2021-02-07 22:33:05,122> DEBUG (AbstractApplicationContext.java:596) [main] (org.springframework.context.support.ClassPathXmlApplicationContext) - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@379619aa
<2021-02-07 22:33:06,330> DEBUG (XmlBeanDefinitionReader.java:393) [main] (org.springframework.beans.factory.xml.XmlBeanDefinitionReader) - Loaded 5 bean definitions from class path resource [applicationContext.xml]
<2021-02-07 22:33:06,597> DEBUG (DefaultSingletonBeanRegistry.java:217) [main] (org.springframework.beans.factory.support.DefaultListableBeanFactory) - Creating shared instance of singleton bean 'org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0'
<2021-02-07 22:33:06,890> DEBUG (PropertySourcesPropertyResolver.java:115) [main] (org.springframework.core.env.PropertySourcesPropertyResolver) - Found key 'jdbc.driver' in PropertySource 'localProperties' with value of type String
<2021-02-07 22:33:06,891> DEBUG (PropertySourcesPropertyResolver.java:115) [main] (org.springframework.core.env.PropertySourcesPropertyResolver) - Found key 'jdbc.url' in PropertySource 'localProperties' with value of type String
<2021-02-07 22:33:06,892> DEBUG (PropertySourcesPropertyResolver.java:115) [main] (org.springframework.core.env.PropertySourcesPropertyResolver) - Found key 'jdbc.username' in PropertySource 'localProperties' with value of type String
<2021-02-07 22:33:06,893> DEBUG (PropertySourcesPropertyResolver.java:115) [main] (org.springframework.core.env.PropertySourcesPropertyResolver) - Found key 'jdbc.password' in PropertySource 'localProperties' with value of type String
<2021-02-07 22:33:06,918> DEBUG (DefaultSingletonBeanRegistry.java:217) [main] (org.springframework.beans.factory.support.DefaultListableBeanFactory) - Creating shared instance of singleton bean 'dataSource'
<2021-02-07 22:33:07,000> DEBUG (DriverManagerDataSource.java:134) [main] (org.springframework.jdbc.datasource.DriverManagerDataSource) - Loaded JDBC driver: com.mysql.jdbc.Driver
<2021-02-07 22:33:07,001> DEBUG (DefaultSingletonBeanRegistry.java:217) [main] (org.springframework.beans.factory.support.DefaultListableBeanFactory) - Creating shared instance of singleton bean 'jdbcTemplate'
<2021-02-07 22:33:07,092> DEBUG (DefaultSingletonBeanRegistry.java:217) [main] (org.springframework.beans.factory.support.DefaultListableBeanFactory) - Creating shared instance of singleton bean 'usersDao'
<2021-02-07 22:33:07,127> DEBUG (DefaultSingletonBeanRegistry.java:217) [main] (org.springframework.beans.factory.support.DefaultListableBeanFactory) - Creating shared instance of singleton bean 'usersService'
<2021-02-07 22:33:07,186> DEBUG (JdbcTemplate.java:860) [main] (org.springframework.jdbc.core.JdbcTemplate) - Executing prepared SQL update
<2021-02-07 22:33:07,191> DEBUG (JdbcTemplate.java:609) [main] (org.springframework.jdbc.core.JdbcTemplate) - Executing prepared SQL statement [insert into users values(default,?,?)]
<2021-02-07 22:33:07,205> DEBUG (DataSourceUtils.java:115) [main] (org.springframework.jdbc.datasource.DataSourceUtils) - Fetching JDBC Connection from DataSource
<2021-02-07 22:33:07,205> DEBUG (DriverManagerDataSource.java:144) [main] (org.springframework.jdbc.datasource.DriverManagerDataSource) - Creating new JDBC DriverManager Connection to [jdbc:mysql://localhost:3306/bjsxt]
Sun Feb 07 22:33:07 CST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:612)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:862)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:917)
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:927)
	at com.bjsxt.dao.impl.UsersDaoImpl.insertDesigns(UsersDaoImpl.java:28)
	at com.bjsxt.service.impl.UsersServiceImpl.addUsers(UsersServiceImpl.java:25)
	at com.bjsxt.test.AddUsersTest.main(AddUsersTest.java:17)
Caused by: java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:864)
	at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1707)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:208)
	at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:155)
	at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:146)
	at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205)
	at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:169)
	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158)
	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
	... 7 more

Process finished with exit code 1

项目:

springiocdemo.rar

MySQL:

image.png


思考:

我之前删过二次MySQL数据库,和这个有关系吗?(安装和卸载都是按教程来的)

问题:

我应该怎么解决,可能是什么原因造成的,辛苦老师了...........


JAVA 全系列/第六阶段:项目管理与SSM框架/Spring 19355楼
JAVA 全系列/第六阶段:项目管理与SSM框架/SpringMVC 19356楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 19357楼
WEB前端全系列/第十一阶段:前端工程化/Webpack 19358楼
JAVA 全系列/第八阶段:Linux入门到实战/Linux(旧) 19359楼
JAVA 全系列/第九阶段:Spring Boot实战/Spring Boot 19361楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 19363楼

flask_shop.zip

image.pngimage.png

老师,帮忙看看吧,这个错误我觉得是app没创建成功或者文件没加载成功,然后我运行__init__文件,出现下面错误,但我是跟老师的写的一样呢,老师帮我看看问题出在哪儿了

image.png


Python 全系列/第九阶段:Flask百战电商后台系统/Flask百战电商后台项目 19365楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637