List:General Discussion« Previous MessageNext Message »
From:lx Date:June 13 2013 9:58am
Subject:Why "ERROR 2003 (HY000): Can't connect to MySQL server on
'192.168.27.72' (111)"?
View as plain text  
hi all:
      I'm a new one. I have a mysql server in 192.168.27.72 , and a mysql
client in 192.168.23.73.
I use this way:
 mysql -h 192.168.27.72 -u root -p

the ERROR message is:
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.27.72' (111)

#########################################################################
mysql> select host, user, password from user;
+-----------------+------------------+-------------------------------------------+
| host            | user             | password
     |
+-----------------+------------------+-------------------------------------------+
| localhost       | root             | 023c30696e164488
     |
| vps192168027072 | root             |
      |
| 127.0.0.1       | root             |
      |
| localhost       |                  |
      |
| vps192168027072 |                  |
      |
| localhost       | monty            | 0fc756bc026507b2
     |
| %               | monty            | 0fc756bc026507b2
     |
| localhost       | gdnscenter       | 184a22a73852ad5b
     |
| %               | gdns_replication | 2dbc2f8719c4ffcd
     |
| %               | root             | 023c30696e164488
     |
| 192.168.23.73   | root             |
*EAB821151A3DE1A8FA76CD28D8F3BBD2389751F6 |
| 0.0.0.0         | root             |
*EAB821151A3DE1A8FA76CD28D8F3BBD2389751F6 |
+-----------------+------------------+-------------------------------------------+
12 rows in set (0.00 sec)
#########################################################################

And in 192.168.27.72
#########################################################################
service iptables status
Firewall is stopped.
#########################################################################

and there are not "bind-address " and "skip_networking" in my.cnf 。


I have installed the mysql in this way:
#########################################################################
yum -y install mysql-server

#vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set = utf8


[mysql]
default-character-set = utf8


[root@sample ~]# chkconfig mysqld on
[root@sample ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off


chattr -i /etc/group
chattr -i /etc/passwd
chattr -i /etc/shadow
chattr -i /etc/gshadow
useradd mysql
chattr +i /etc/group
chattr +i /etc/passwd
chattr +i /etc/shadow
chattr +i /etc/gshadow


chown mysql /var/run/mysqld/

cd /var/lib/mysql
chown mysql -R *
cd 

mysql_install_db --user=mysql --ldata=/var/lib/mysql


[root@sample ~]# /etc/rc.d/init.d/mysqld start

#########################################################################


Thank you

Thread
Why "ERROR 2003 (HY000): Can't connect to MySQL server on'192.168.27.72' (111)"?lx13 Jun
  • Re: Why "ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.27.72' (111)"?Johan De Meersman13 Jun