遠(yuǎn)程連接Mysql數(shù)據(jù)庫(kù)問題(ERROR 2003 (HY000)) - 輝蛋兒的學(xué)習(xí)歷程 - 博客頻道 - CSDN.NET
困擾我一天的問題終于被這位大俠給解決了,再次表示感謝:
落羽? http://blog.163.com/xiaohui_1123@126/blog/static/3980524020101129143017/
? ?
在我們用客戶端及其遠(yuǎn)程連接服務(wù)器Mysql數(shù)據(jù)庫(kù)的過程中,容易出現(xiàn)下面問題:
問題代碼代碼
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)
????? 這個(gè) 原因就是Mysql數(shù)據(jù)庫(kù)的默認(rèn)配置文件my.cnf(linux下)中的bind-address默認(rèn)為127.0.0.1,所以就算你創(chuàng)建了可以 remote訪問的用戶,你也不能使用mysql -h命令進(jìn)行訪問,若訪問就會(huì)出現(xiàn)上出問題,因?yàn)榇藭r(shí)Mysql只接受localhost,所以需要把bind-address屏蔽掉。???? my.cnf一般在/etc/mysql下面,如果不在使用locate my.cnf查找,修改前的my.cnf配置文件為:
修改前的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???? 我們需要做的就是屏蔽這個(gè)bind-address代碼,屏蔽后代碼為:
?
屏蔽后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???? 現(xiàn)在你就可以用mysql -h命令進(jìn)行你想做的操作了,如登錄系統(tǒng):
?
登陸數(shù)據(jù)庫(kù)代碼
mysql -h 192.168.0.19 -u root -p
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
