Home > Back-end >  Springboot connection data Access denied for user 'root' @ 'localhost' (using pa
Springboot connection data Access denied for user 'root' @ 'localhost' (using pa

Time:05-26

Database password is correct, the second computer to run the same code up, the computer can't run

The Exception encountered during the context initialization - cancelling refresh attempt: org. Springframework. Beans. Factory. UnsatisfiedDependencyException: Error creating bean with the name 'userController: Unsatisfied dependency expressed through the field' userService '; Nested exception is org. Springframework. Beans. Factory. UnsatisfiedDependencyException: Error creating bean with the name 'userServiceImpl: Unsatisfied dependency expressed through the field' userMapper '; Nested exception is org. Springframework. Beans. Factory. UnsatisfiedDependencyException: Error creating bean with the name 'userMapper defined in the file [D: \ chyx \ chuhui \ ch - user \ service \ target \ classes \ com \ wyqf365 \ user \ mapper \ userMapper class] : Unsatisfied dependency expressed through the bean property' sqlSessionFactory '; Nested exception is org. Springframework. Beans. Factory. BeanCreationException: Error creating bean with the name 'sqlSessionFactory defined in the class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration class] : bean instantiation via the factory method failed; Nested exception is org. Springframework. Beans. BeanInstantiationException: Failed to instantiate [org. Apache. Ibatis. Session. SqlSessionFactory] : the Factory method 'SqlSessionFactory threw the exception. Nested exception is com. Baomidou. Mybatisplus. Core. Exceptions. MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail! Cause: the Java. SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)

CodePudding user response:

The root user without access

CodePudding user response:

reference 1/f, Little BigUs response:
root user does not have access to
have local access, had just seen

CodePudding user response:

Check yml configuration file is correct, whether the database is authorized

CodePudding user response:

The debug data source instantiation process, to see what the password is

CodePudding user response:

The root user without permission, in mysql give permission first

CodePudding user response:

Database access problem, get into the mysql open access

 
The use of mysql;
Grant all on *. * to 'root' @ '%' with grant option;
Flush privileges;

CodePudding user response:

Before I had a similar problem, is the code is no problem; Reconstruction of a project, complete the same code can run;

CodePudding user response:

See this article, finally has a solution: https://blog.csdn.net/qq_17555933/article/details/117229900? SPM=1001.2014.3001.5501
  • Related