用戶名和密碼都正確,總是出現(xiàn)下面問題,誰可以幫忙解決啊,謝謝
Could not obtain connection to query metadata : Access denied for user ''@'localhost' (using password: YES)
Could not obtain connection to query metadata : Access denied for user ''@'localhost' (using password: YES)
舉報(bào)
2017-07-18
1,驅(qū)動配置有誤:driver=com.MySQL.jdbc.Driver
2,數(shù)據(jù)庫連接地址有誤:url=jdbc:mysql://localhost:3306/test?3useUnicode=true&characterEncoding=utf8
3,密碼或帳號有誤:username=root ? ? ? ? ??password=root
4,數(shù)據(jù)庫未啟動或無權(quán)訪問
5,項(xiàng)目未引入對應(yīng)的驅(qū)動jar包mysql-connector-Java-5.x.x-bin.jar
6,mysql root沒有遠(yuǎn)程訪問的權(quán)限,需要增加權(quán)限,增加權(quán)限的步驟如下:
進(jìn)入mysql數(shù)據(jù)庫:
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;