gpt4 book ai didi

mysql - IP 表 : connexion refused with MySQL (10061)

转载 作者:行者123 更新时间:2023-11-30 23:00:17 25 4
gpt4 key购买 nike

在提问之前我先阅读了这个:http://dev.mysql.com/doc/refman/5.0/fr/access-denied.html第一次尝试:

~# mysql -h 127.0.0.1 -P 3306 -u uu DBNAME -p
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3296
Server version: 5.5.37-MariaDB-1~wheezy-log mariadb.org binary distribution

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [DBNAME]> Bye

~# mysql -h 127.0.0.1 -P 3307 -u uu DBNAME -p
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

所以它正在监听端口 3306。现在让我们看看我的网络配置:

~# ifconfig
eth0 Link encap:Ethernet HWaddr d4:ae:52:cd:71:d6
inet addr:62.210.129.132 Bcast:62.210.129.255 Mask:255.255.255.0
blabla

~#

所以让我们尝试使用正确的工作端口而不是 127.0.0.1:

~# mysql -h 62.210.129.132 -P 3306 -u uu DBNAME -p
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

所以我尝试用以下方法修复它:

MariaDB [DBNAME]> GRANT ALL PRIVILEGES ON DBNAME TO 'uu'@'62.%' IDENTIFIED BY 'XX';
Query OK, 0 rows affected (0.00 sec)

MariaDB [DBNAME]> GRANT ALL PRIVILEGES ON DBNAME.* TO 'uu'@'62.%' IDENTIFIED BY 'XX';
Query OK, 0 rows affected (0.00 sec)

MariaDB [DBNAME]> Bye
~# mysql -h 62.210.129.132 -u uu DBNAME -p
ERROR 2003 (HY000): Can't connect to MySQL server on '62.210.129.132' (111)
~#

~# mysql -h 127.0.0.1 -u uu DBNAME -p
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

... blabla

我也检查了表用户:

MariaDB [mysql]> select user, host, password from user;
+------------------+----------------+--------------------+
| user | host | password |
+------------------+----------------+--------------------+
| [skipping root ] |
| uu | localhost | *C5E430FB96FF191AF |
| uu | 62.210.129.132 | *C5E430FB96FF191AF |
| uu | 62.% | *C5E430FB96FF191AF |
+------------------+----------------+--------------------+
9 rows in set (0.00 sec)

MariaDB [mysql]>

所以不工作。所以我想知道它是来 self 的 ip 策略还是来自 mysql 服务器策略。这是 iptables 策略:

Chain PREROUTING (policy ACCEPT 1143 packets, 131K bytes)
pkts bytes target prot opt in out source destination

Chain INPUT (policy ACCEPT 56 packets, 2938 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 236 packets, 17506 bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 236 packets, 17506 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
1 211 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT tcp -- eth0 * 62.210.129.132 0.0.0.0/0
0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 3 packets, 852 bytes)
pkts bytes target prot opt in out source destination

我错过了什么,我应该去哪里找?

最佳答案

感谢this question ,我找到了解决方案。结果我只需要在我的 my.cnf 文件中注释 bind-address 指令:

#bind-address       = 127.0.0.1

然后就可以了。

关于mysql - IP 表 : connexion refused with MySQL (10061),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24384784/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com