今天嘗試使用spring和mybaits時,在配置數據庫時,在jdbc.properties中寫了以下配置java
driver=com.mysql.jdbc.Driver url=jdbc:mysql://127.0.0.1:3306/***?useUnicode=true&characterEncoding=utf8 username=root password=***
後來在測試的時候發現一直提示沒法鏈接數據庫,並且它的提示很奇怪:java.sql.SQLException: Access denied for user 'lc'@'localhost' (using password: YES)
這邊的'lc'是我係統(windows)的用戶名,後來上網查閱相關資料得知在配置中設置了username屬性,會與Windows的基本配置衝突,只須要將username改成name便可。mysql
driver=com.mysql.jdbc.Driver url=jdbc:mysql://127.0.0.1:3306/***?useUnicode=true&characterEncoding=utf8 name=root password=***