天天看點

用戶端連接配接mysql出錯

3人閱讀

如果你想連接配接你的mysql的時候發生這個錯誤:

ERROR 1130: Host '192.168.16.145' is not allowed to connect to this MySQL server

改表法。

可能是你的帳号不允許從遠端登陸,隻能在localhost。這個時候隻要在localhost的那台電腦,登入mysql後,更改 "mysql" 資料庫裡的 "user" 表裡的 "host" 項,從"localhost"改稱"%"

2. 授權法。

(1)例如:你想myuser使用mypassword從任何主機連接配接到mysql伺服器的話

(2)如果你想允許使用者myuser從ip為192.168.16.145的主機連接配接到mysql伺服器,并使用mypassword作為密碼

(3)最後這句一定一定要加上!!!

出現如下錯誤:

Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. java.net.ConnectException: Connection refused: connect

這時候,你需要登入到伺服器裡面按照如下方法設定你的mysql并重新開機mysql

将配置裡面的bind-address = 127.0.0.1

這一項改成bind-address = 0.0.0.0

取消MySQL Server 綁定本地位址!

之後儲存退出(wq)

繼續閱讀