首页 > 代码库 > ERROR 2003 (HY000): Can't connect to MySQL server on 'ip address' (111)的处理办法

ERROR 2003 (HY000): Can't connect to MySQL server on 'ip address' (111)的处理办法

远程连接mysql数据库时可以使用以下指令

mysql -h 192.168.1.104 -u root -p

如果是初次安装mysql,需要将所有/etc/mysql/内的所有配置文件的bind-address=127.0.0.1全都注释掉

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# 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

如果不配置的话会出ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘ip address‘ (111)故障。

ERROR 2003 (HY000): Can't connect to MySQL server on 'ip address' (111)的处理办法