ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.33.10' (111) 解决方法

Posted Basu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.33.10' (111) 解决方法相关的知识,希望对你有一定的参考价值。

谷歌了一下之后,原来是在mysql的my.cnf中有下面一段代码:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address           = 127.0.0.1  #这里默认监听本地localhost

 



如果要让mysql监听到其他的地址,可以将bind-address = 127.0.0.1注释掉。 

或者将bind-address = 0.0.0.0监听所有的地址

 

 

如果想让192.168.10.83能够连接到本地的这个数据库,要让数据库给其分配权限,登录mysql,执行:(username 和 password是登录mysql的用户名和密码)

GRANT ALL PRIVILEGES ON *.* TO username@192.168.10.83 IDENTIFIED BY password WITH GRANT OPTION;


如果要想所有的外部ip地址都能够访问使用mysql,可以执行下面:
GRANT ALL PRIVILEGES ON *.* TO username@% IDENTIFIED BY password WITH GRANT OPTION;

 

之后执行刷新数据库:

flush privileges;

 





以上是关于ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.33.10' (111) 解决方法的主要内容,如果未能解决你的问题,请参考以下文章

ERROR 2003 (HY000): Can't connect to MySQL server on 'ip'(111)

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

MySQL显示ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)解决方法

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061),mysql服务已启动(示例代码

错误 2003 (HY000): 无法连接到 MySQL 服务器 (111)