国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

遠程連接MySQL報錯ERROR 2003解決辦法

2024-07-24 12:38:06
字體:
來源:轉載
供稿:網友

在mysql遠程連接時出現ERROR 2003錯誤的很多種,下面我來給大家介紹兩種解決此問題的方法,有需要的同學可參考.

問題代碼:

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屏蔽掉.

my.cnf一般在/etc/mysql下面,如果不在使用locate my.cnf查找,修改前的my.cnf配置文件為,修改前的my.cnf配置文件代碼:

  1.  
  2. # Instead of skip-networking the default is now to listen only on  
  3. # localhost which is more compatible and is not less secure.  
  4. bind-address = 127.0.0.1  
  5. # 
  6. # Instead of skip-networking the default is now to listen only on 
  7. # localhost which is more compatible and is not less secure. 
  8. bind-address = 127.0.0.1 

我們需要做的就是屏蔽這個bind-address代碼.屏蔽后代碼為,屏蔽后my.cnf配置文件代碼:

  1. #  
  2. Instead of skip-networking the default is now to listen only on  
  3. # localhost which is more compatible and is not less secure.  
  4. #bind-address = 127.0.0.1  
  5. #  --Vevb.com 
  6. Instead of skip-networking the default is now to listen only on 
  7. # localhost which is more compatible and is not less secure. 
  8. #bind-address = 127.0.0.1 

現在你就可以用mysql -h命令進行你想做的操作了,如登錄系統,登陸數據庫代碼:

mysql -h 192.168.0.19 -u root -p

如果上面還不能解決可能是防火墻的問題了.

1.mysql 錯誤 ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost'

解決辦法:關閉防火墻,linux下命令:

  1. [root@etl01 bin]# chkconfig --list | grep -i iptables  ====check fire wall 
  2. iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off 
  3. [root@etl01 bin]# /sbin/service iptables stop           ====stop fire wall 
  4. Flushing firewall rules: [  OK  ] 
  5. Setting chains to policy ACCEPT: nat filter [  OK  ] 
  6. Unloading iptables modules: [  OK  ] 

2.報錯:1130-host ... is not allowed to connect to this MySql server

解決辦法:

授權形式,比如賬戶為root,密碼為root:use mysql;用root賬戶從任何主機上訪問mysql數據庫了,GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

如果你想允許用戶zz從ip為192.168.1.3的主機連接到mysql服務器,并使用123456作為密碼:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY '123456' WITH GRANT OPTION;

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 财经| 曲水县| 临高县| 吉木乃县| 南和县| 若尔盖县| 汨罗市| 鄂伦春自治旗| 甘洛县| 伊吾县| 康平县| 汽车| 读书| 潞西市| 茂名市| 蒙阴县| 洪泽县| 酉阳| 武鸣县| 塔河县| 郸城县| 浮山县| 青阳县| 泾阳县| 景宁| 泽库县| 普兰店市| 澄迈县| 大悟县| 施甸县| 班玛县| 德兴市| 临江市| 平利县| 年辖:市辖区| 遵义县| 大余县| 萨迦县| 肇庆市| 龙山县| 邢台县|