idea启动报错:Access denied for user 'root '@'192.168.100.206' (using password: YES)

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘sysUserMapper‘ defined in file [D:\workspace\b2b_refactor\b2b_refactor\target\classes\com\zj\web\system\mapper\SysUserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘gctxSqlSessionFactory‘ defined in class path resource [com/zj/config/DataSourceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘gctxSqlSessionFactory‘ threw exception; nested exception is com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user ‘root ‘@‘192.168.100.206‘ (using password: YES)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1357)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1249)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
... 149 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘gctxSqlSessionFactory‘ defined in class path resource [com/zj/config/DataSourceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘gctxSqlSessionFactory‘ threw exception; nested exception is com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user ‘root ‘@‘192.168.100.206‘ (using password: YES)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1342)
... 160 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘gctxSqlSessionFactory‘ threw exception; nested exception is com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user ‘root ‘@‘192.168.100.206‘ (using password: YES)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 172 common frames omitted
Caused by: com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user ‘root ‘@‘192.168.100.206‘ (using password: YES)
at com.baomidou.mybatisplus.toolkit.GlobalConfigUtils.setMetaData(GlobalConfigUtils.java:196)
at com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:560)
at com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:385)
at com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean.getObject(MybatisSqlSessionFactoryBean.java:608)
at com.zj.config.DataSourceConfig.gctxSqlSessionFactory(DataSourceConfig.java:63)
at com.zj.config.DataSourceConfig$$EnhancerBySpringCGLIB$$4aa4d4ab.CGLIB$gctxSqlSessionFactory$2(<generated>)
at com.zj.config.DataSourceConfig$$EnhancerBySpringCGLIB$$4aa4d4ab$$FastClassBySpringCGLIB$$39462b28.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at com.zj.config.DataSourceConfig$$EnhancerBySpringCGLIB$$4aa4d4ab.gctxSqlSessionFactory(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 173 common frames omitted
Disconnected from the target VM, address: ‘127.0.0.1:64866‘, transport: ‘socket‘

Process finished with exit code 1

解决方法:

在配置文件中,

spring.datasource.gctx.driverClassName = com.mysql.jdbc.Driver#spring.datasource.gctx.url= jdbc:mysql://47.93.28.5:13306/b2b_test?useUnicode=yes&characterEncoding=UTF-8&useSSL=falsespring.datasource.gctx.url= jdbc:mysql://192.168.100.208:3306/b2b_test?useUnicode=yes&characterEncoding=UTF-8&useSSL=falsespring.datasource.gctx.username = root spring.datasource.gctx.password = 123456配置文件第四行,root后面加了一个空格,粗心大意导致的问题,最后复制一份同事的配置文件得以解决。

度娘建议的解决方案都是,

 这是因为当前用户没有访问mysql的权限导致的在mysql中执行:grant all privileges on *.* to [email protected]‘%‘ identified by ‘root‘;

就可以访问了。

 尝试了好多遍:

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
   flush privileges;

最终,去掉空格,问题解决。

idea启动报错:Access denied for user 'root '@'192.168.100.206' (using password: YES)

原文地址:https://www.cnblogs.com/bruce-young/p/10101243.html

时间: 2024-10-08 14:56:50

idea启动报错:Access denied for user 'root '@'192.168.100.206' (using password: YES)的相关文章

MySQL ERROR 1045 (28000): Access denied for user &#39;root&#39;@&#39;192.168.23.224&#39; (using password: YES)

出现如题错误可能原因: 1.密码有误.检查密码是否与 mysql.user 中 root 用户对应密码一致(我就是这个原因,被折磨整个下午和晚上) 2.用户 root 没有授权,授权命令如下: grant all on *.* to [email protected]'%' identified by 'password'; flush privileges; 3.数据库端口被墙了.关闭防火墙或者添加端口特例 MySQL ERROR 1045 (28000): Access denied for

Caused by: java.sql.SQLException: Access denied for user &#39;root&#39;@&#39;192.168.6.131&#39; (using password: YES),远程连接数据库,连接不上解决方案

进入 mysql   ; use mysql; 然后 执行 GRANT ALL PRIVILEGES ON *.* TO [email protected]"你.的.端.口" IDENTIFIED BY "你的密码" WITH GRANT OPTION; FLUSH PRIVILEGES; 然后成功 Caused by: java.sql.SQLException: Access denied for user 'root'@'192.168.6.131' (usi

【异常】连接MySQL权限异常SQLException: Access denied for user &#39;root&#39;@&#39;192.168.xxx.xxx&#39; (using password: YES)

IDEA程序访问Mysql,出现权限异常.SQLException: Access denied for user 'root'@'192.168.119.1' (using password: YES)应该是mysql中的库.表等对特定的用户.特定的ip开放,所以可以修改一下,在mysql中执行:grant all privileges on *.* to [email protected]'%' identified by '123456';表示root用户可以在任何ip都可以访问任何库,密

Windows下mysql无法启动1067错误 以及 登录报错Access denied for user ‘root’@‘localhost’ (using password:YES)

Windows下mysql无法启动1067错误解决: 解决步骤: 1.  找到自己的mysql安装目录,比如,我的是D:\MySQL\MySQL Server 5.5 2.  打开my.ini文件 3.  找到 #Path to the database root这一行,将 datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/"    修改为自己mysql安装目录下的  datadir="D:/MySQL/MySQL Ser

网站报错Access denied for user &#39;root&#39;@&#39;localhost&#39; -问题排查续

网站报错Access denied for user 'root'@'localhost' (using password: YES) 每次的挽救办法就是: /etc/init.d/mysqld stop mysqld_safe --skip-grant-tables & 几乎每隔10分钟就出现一次,如下图,然后手动安全模式重启mysql.偶的内心好崩溃... 不得不赞阿里云的售后技术支持太给力!耐心回复我的一个个小白问题. 总结一下, 问题原因:本地授权问题 解决办法:“您目前启动到mysql

linux mysql报错Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: YES)

1.service mysqld stop停止mysql服务器 2.find / -name my.cnf 查找mysql配置文件的位置打开 3.在[mysqld]后添加skip-grant-tables 4.启动mysql :service mysqld start ————————————————版权声明:本文为CSDN博主「awake720」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net/awake

最新 mysql登录报错“Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: NO”的处理方法

1.关闭正在运行的MySQL.2.打开DOS窗口,转到mysql\bin目录.3.输入mysqld --skip-grant-tables回车.如果没有出现提示信息,那就对了.4.再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysql\bin目录.5.输入mysql回车,如果成功,将出现MySQL提示符 <6. 连接权限数据库<use mysql; (<是本来就有的提示符,别忘了最后的分号)6.改密码:update MySQL.user set authenticati

mysql登录报错“Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: YES”的处理方法

使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 文件内容: [client]host = localhostuser = debian-sys-maint   //用户名password = Xgsuj2n8rlvw7jUO  //密码socket = /var/run/mysqld/mysqld.sock[mysql_upgrade]host = localhostuser = debian-sys-maintpassword = Xgsuj2n8r

关于Linux下面msyql安装后并未设置初始密码,但是登录报错“Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: NO)”的解决方案

如上图:首先我安装mysql的时候并没有设置密码,但是就是登不进去,百度了一下,解决方案如下: 解决方案地址:http://zhidao.baidu.com/link?url=7QvuOKtfRdMTyFCsOf_6Bbb6pHGUxzyr5_afFGLiX_WAD6JJ4MCmepriWnzIo-kEAetXCLsRRhIidzxbL6zTnnJlP3HbYh2DDLZOEbOvBji 关于Linux下面msyql安装后并未设置初始密码,但是登录报错"Access denied for use