无法连接到 MySQL 服务器错误 111 [英] Can't connect to MySQL server error 111

查看:43
本文介绍了无法连接到 MySQL 服务器错误 111的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 linux box IP = 192.168.1.100 上安装了 mysql 服务器,但是当我尝试连接到这个 IP 时,它总是错误 (111).但是使用 localhost 和 127.0.0.1 就可以了.

<前>beer@beer-laptop# ifconfig |grep "inet 地址"inet 地址:127.0.0.1 掩码:255.0.0.0inet 地址:192.168.1.100 广播:192.168.1.255 掩码:255.255.255.0beer@beer-laptop# mysql -ubeer -pbeer -h192.168.1.100错误 2003 (HY000):无法连接到192.168.1.100"上的 MySQL 服务器 (111)beer@beer-laptop# mysql -ubeer -pbeer -hlocalhost欢迎使用 MySQL 监视器.命令以 ; 结尾或\g.你的 MySQL 连接 ID 是 160服务器版本:5.1.31-1ubuntu2 (Ubuntu)输入帮助;"或 '\h' 寻求帮助.键入 '\c' 以清除缓冲区.mysql>beer@beer-laptop# mysql -ubeer -pbeer -h127.0.0.1欢迎使用 MySQL 监视器.命令以 ; 结尾或\g.你的 MySQL 连接 ID 是 161服务器版本:5.1.31-1ubuntu2 (Ubuntu)输入帮助;"或 '\h' 寻求帮助.键入 '\c' 以清除缓冲区.mysql>

从另一台机器连接它也出现错误 111.

<前>另一个@another-laptop# mysql -ubeer -pbeer -h192.168.1.100错误 2003 (HY000):无法连接到192.168.1.100"上的 MySQL 服务器 (111)

在这种情况下使用 localhost/127.0.0.1 和 192.168.1.100 之间的区别.我不知道如何从另一台机器连接到这个数据库.

请帮忙.谢谢.

解决方案

这可能意味着你的 MySQL 服务器只监听 localhost 接口.

如果你有这样的行:

绑定地址 = 127.0.0.1

在您的my.cnf 配置文件中,您应该对它们进行注释(在行首添加#),然后重启MySQL.

sudo service mysql restart

当然,要做到这一点,您必须是服务器的管理员.

I installed mysql server on linux box IP = 192.168.1.100 but when i try to connect to this IP it alway error(111). but use localhost and 127.0.0.1 is OK.

beer@beer-laptop# ifconfig | grep "inet addr"
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0

beer@beer-laptop# mysql -ubeer -pbeer -h192.168.1.100
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.100' (111)

beer@beer-laptop# mysql -ubeer -pbeer -hlocalhost
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 160
Server version: 5.1.31-1ubuntu2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

beer@beer-laptop# mysql -ubeer -pbeer -h127.0.0.1
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 161
Server version: 5.1.31-1ubuntu2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

Connect from another machine it also error 111.

another@another-laptop# mysql -ubeer -pbeer -h192.168.1.100
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.100' (111)

How difference between use localhost/127.0.0.1 and 192.168.1.100 in this case. I don't know how to connect to this database from another machine.

Help please. Thank.

解决方案

It probably means that your MySQL server is only listening the localhost interface.

If you have lines like this :

bind-address = 127.0.0.1

In your my.cnf configuration file, you should comment them (add a # at the beginning of the lines), and restart MySQL.

sudo service mysql restart

Of course, to do this, you must be the administrator of the server.

这篇关于无法连接到 MySQL 服务器错误 111的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆