首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 > Can't connect to MySQL server error 111 ,怎么办?

Can't connect to MySQL server error 111 ,怎么办?
EN

Stack Overflow用户
提问于 2018-02-26 05:37:08
回答 2查看 0关注 0票数 0

我在LinuxboxIP=192.168.1.100上安装了MySQL服务器,但是当我试图连接到这个IP时,总是会出现错误(111),但是使用localhost和127.0.0.1就可以了。

代码语言:txt
复制
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> 

从另一台机器连接,也会出错111。

代码语言:txt
复制
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)

在本例中,使用localhost/127.0.0.1和192.168.1.100之间的差异如何。我不知道如何从另一台机器连接这个数据库。

请帮帮忙。谢谢。

EN

回答 2

Stack Overflow用户

发布于 2018-02-26 14:36:22

代码语言:txt
复制
skip-networking
bind-address = 127.0.0.1
票数 0
EN

Stack Overflow用户

发布于 2018-02-26 15:34:46

111表示拒绝连接,这意味着mysqld只侦听localhost接口。

若要更改它,您可能需要查看my.cnf文件,bind-address值中的mysqld

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100007439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档