用戶名和密碼都正確,總是出現(xiàn)下面問(wèn)題,誰(shuí)可以幫忙解決啊,謝謝
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ū)動(dòng)配置有誤:driver=com.MySQL.jdbc.Driver
2,數(shù)據(jù)庫(kù)連接地址有誤:url=jdbc:mysql://localhost:3306/test?3useUnicode=true&characterEncoding=utf8
3,密碼或帳號(hào)有誤:username=root ? ? ? ? ??password=root
4,數(shù)據(jù)庫(kù)未啟動(dòng)或無(wú)權(quán)訪問(wèn)
5,項(xiàng)目未引入對(duì)應(yīng)的驅(qū)動(dòng)jar包mysql-connector-Java-5.x.x-bin.jar
6,mysql root沒(méi)有遠(yuǎn)程訪問(wèn)的權(quán)限,需要增加權(quán)限,增加權(quán)限的步驟如下:
進(jìn)入mysql數(shù)據(jù)庫(kù):
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;