idea PersistenceException Failed to obtain JDBC Connection(密碼正確,但拒絕訪問)

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
### The error may exist in file [E:\javatools\idea-workspace\ccs\target\classes\mapper\noticeMapper.xml]
### The error may involve com.igeekhome.ccs.dao.noticeMapper.save
### The error occurred while executing an update
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
  1. 網上方法,重裝數據庫
  2. 換jar包,這個試了沒用
    mysql-connector-java與Mysql對應版本:

Connector/J version Driver Type JDBC version MySQL Server version Status
5.1 4 3.0, 4.0, 4.1, 4.2 5.6*, 5.7*, 8.0* General availability
8.0 4 4.2 5.6, 5.7, 8.0 General availability. Recommended version

  • MySQL Connector/J 8.0 is highly recommended for use with MySQL Server 8.0, 5.7, and 5.6. Please upgrade to MySQL Connector/J 8.0.

官方更推薦MySQL5.6以上使用connector/j 8.0

  1. 網上說username可能和springboot裏面username重名了,導致報錯賬號密碼不對,這個我不會改
  2. 最後的解決辦法
    密碼加雙引號,因爲000在數據庫裏看做0
    在這裏插入圖片描述
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章