溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

怎么解決數(shù)據(jù)庫(kù)ERROR 2003問(wèn)題

發(fā)布時(shí)間:2021-11-15 13:35:04 來(lái)源:億速云 閱讀:227 作者:iii 欄目:MySQL數(shù)據(jù)庫(kù)

這篇文章主要介紹“怎么解決數(shù)據(jù)庫(kù)ERROR 2003問(wèn)題”,在日常操作中,相信很多人在怎么解決數(shù)據(jù)庫(kù)ERROR 2003問(wèn)題問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”怎么解決數(shù)據(jù)庫(kù)ERROR 2003問(wèn)題”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

[root@ora102 ~]# mysql -uroot -pchinabidding -h292.168.8.247

Warning: Using a password on the command line interface can be insecure.

排查問(wèn)題:

1)網(wǎng)絡(luò)是通的

ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.8.247' (113)

[root@ora102 ~]# ping  192.168.8.247

PING 192.168.8.247 (192.168.8.247) 56(84) bytes of data.

64 bytes from 192.168.8.247: icmp_seq=1 ttl=64 time=0.510 ms

64 bytes from 192.168.8.247: icmp_seq=2 ttl=64 time=0.446 ms

64 bytes from 192.168.8.247: icmp_seq=3 ttl=64 time=0.475 ms

2)權(quán)限是沒(méi)問(wèn)題的

MySQL [(none)]> select host,user,password from mysql.user;

+-----------+------+-------------------------------------------+

| host      | user | password                                  |

+-----------+------+-------------------------------------------+

| localhost | root | *2548EFB13B516547C44482A519B886726A3B8E42 |

|%| root | *2548EFB13B516547C44482A519B886726A3B8E42 |

| 127.0.0.1 | root | *2548EFB13B516547C44482A519B886726A3B8E42 |

| ::1       | root | *2548EFB13B516547C44482A519B886726A3B8E42 |

3)vi /etc/my.cnfi 查看參數(shù)bind-address  是否設(shè)置成了  = 127.0.0.1

我壓根沒(méi)有設(shè)置這個(gè)參數(shù),這個(gè)參數(shù)是默認(rèn)是127.0.0.1,限制只能本地登錄。

4)查看防火墻狀態(tài),如下,active的,防火墻的是開(kāi)的。

bogon:root@~>service  iptables status

Redirecting to /bin/systemctl status  iptables.service

● iptables.service - IPv4 firewall with iptables

Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)

Active: active (exited)since Wed 2017-12-06 15:01:37 CST; 2s ago

Process: 21617 ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited, status=0/SUCCESS)

Process: 22369 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)

Main PID: 22369 (code=exited, status=0/SUCCESS)

Dec 06 15:01:37 bogon systemd[1]: Starting IPv4 firewall with iptables...

Dec 06 15:01:37 bogon iptables.init[22369]: iptables: Applying firewall rules: [  OK  ]

Dec 06 15:01:37 bogon systemd[1]: Started IPv4 firewall with iptables.

查看端口,然后嘗試去遠(yuǎn)端telnet 這個(gè)端口是否是同的。

MySQL [(none)]> show global variables like 'port';

+---------------+-------+

| Variable_name | Value |

+---------------+-------+

| port          | 3306  |

+---------------+-------+

1 row in set (0.00 sec)

telne果然是不通的

[root@ora102 ~]# telnet 192.168.8.247 3306

Trying 192.168.8.247...

telnet: connect to address 192.168.8.247: No route to host

在源段關(guān)閉防火墻:

bogon:root@~>service  iptables stop

Redirecting to /bin/systemctl stop  iptables.service

永久關(guān)閉:

bogon:root@~>chkconfig iptables on

再次在遠(yuǎn)程登陸,正常了。。。。

[root@ora102 ~]# mysql -uroot -pchinabidding -h292.168.8.247

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 21

Server version: 5.5.29-log Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

到此,關(guān)于“怎么解決數(shù)據(jù)庫(kù)ERROR 2003問(wèn)題”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI