資料庫密碼都正確,同樣的代碼 第二臺電腦跑的起來,這個電腦跑不起來
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\chyx\chuhui\ch-user\service\target\classes\com\wyqf365\user\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail ! Cause:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
uj5u.com熱心網友回復:
root 用戶沒有訪問權限uj5u.com熱心網友回復:
有本地的訪問權限,剛看過uj5u.com熱心網友回復:
檢查下yml的組態檔是否正確,看下資料庫是否授權uj5u.com熱心網友回復:
debug資料源實體化的程序,去看看到底密碼是什么uj5u.com熱心網友回復:
root用戶沒有權限,在mysql里面先給權限就好了uj5u.com熱心網友回復:
資料庫權限的問題,得進mysql里面開啟權限
use mysql;
grant all on *.* to 'root'@'%' with grant option;
flush privileges;
uj5u.com熱心網友回復:
我之前也遇到過類似的問題,就是代碼都沒問題;重建一個專案,完全一摸一樣的代碼就能跑起來;uj5u.com熱心網友回復:
看這篇文章,最后有解決方案:https://blog.csdn.net/qq_17555933/article/details/117229900?spm=1001.2014.3001.5501轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/285062.html
標籤:Java EE
上一篇:java資料接收轉換問題