您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“解決springboot連接mysql時報錯usingpassword:NO的方法”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
最近使用 springboot 配置 mysql 時出現(xiàn)了一個錯誤Access denied for user ''@'localhost' (using password: YES) 或者Access denied for user ''@'localhost' (using password: NO)
經(jīng)發(fā)現(xiàn)這是 springboot 中 yml 語法的的一個坑,在我現(xiàn)在用的最新版本2.2.4 的springBoot中所推薦 yml 的格式是
data-username: rootdata-password: 112233
就是前面加了 data- 的這種格式導(dǎo)致了這個錯誤,
單獨使用 data-username 報錯 using password: YES
如果使用 data-password 報錯 using password: NO
后來查看源碼發(fā)現(xiàn),對于 username 和 password 的參數(shù)有一句這樣的說明:Login username of the database./ Login password of the database.而 data-username 和 data-password 的說明又有不同:
Username of the database to execute DML scripts (if different). / Password of the database to execute DML scripts (if different).執(zhí)行DML腳本的數(shù)據(jù)庫的用戶名(如果有)。
“解決springboot連接mysql時報錯usingpassword:NO的方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。