《Mysql必讀詳解遠程連接Mysql數據庫的問題(ERROR 2003 (HY000))》要點:
本文介紹了Mysql必讀詳解遠程連接Mysql數據庫的問題(ERROR 2003 (HY000)),希望對您有用。如果有疑問,可以聯系我們。
在我們用客戶端及其遠程連接服務器Mysql數據庫的過程中,容易出現下面問題:
問題代碼代碼
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.19' (111)?
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.19' (111)????? 這個 原因就是Mysql數據庫的默認配置文件my.cnf(linux下)中的bind-address默認為127.0.0.1,所以就算你創建了可以 remote拜訪的用戶,你也不能使用mysql -h命令進行拜訪,若拜訪就會出現上出問題,因為此時Mysql只接受localhost,所以需要把bind-address屏蔽掉.MYSQL教程
my.cnf一般在/etc/mysql下面,如果不在使用locate my.cnf查找,修改前的my.cnf配置文件為:MYSQL教程
修改前的my.cnf配置文件代碼
#?
# Instead of skip-networking the default is now to listen only on?
# localhost which is more compatible and is not less secure.?
bind-address?????????? = 127.0.0.1?
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address?????????? = 127.0.0.1
我們必要做的就是屏蔽這個bind-address代碼,屏蔽后代碼為:MYSQL教程
屏蔽后my.cnf配置文件代碼
#?
# Instead of skip-networking the default is now to listen only on?
# localhost which is more compatible and is not less secure.?
#bind-address?????????? = 127.0.0.1?
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address?????????? = 127.0.0.1
現在你就可以用mysql -h命令進行你想做的操作了,如登錄系統:MYSQL教程
登岸數據庫代碼
mysql -h 192.168.0.19 -u root -p
MYSQL教程
維易PHP培訓學院每天發布《Mysql必讀詳解遠程連接Mysql數據庫的問題(ERROR 2003 (HY000))》等實戰技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養人才。