Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My mail server (Ubuntu 10.04) uses mysql for virtual domains, virtual users. For some reason, mysqld has started refusing connections from localhost. I see these in the mail server log:

Oct 6 00:31:14 apollo postfix/trivial-rewrite[16888]: fatal:
proxy:mysql:/etc/postfix/,lock|fold_fix): table
lookup problem


Oct 7 13:39:15 apollo postfix/proxymap[25839]: warning: connect to mysql server Lost connection to MySQL server at 'reading initial communication
packet', system error: 0

I also get the following in auth.log:

Oct 6 22:33:31 apollo mysqld[31775]: refused connect from

Telnet to the local port:

root@apollo:/var/log/mysql# telnet localhost 3306
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

I am not sure why this started happening, but there was a disk failure in a RAID 1 pair a bit earlier that day. So it's possible I have a damaged config file or something. But mail was working for at least an hour after the drive event, so who knows for sure?

phpmyadmin works fine, and the databases themselves look like they're intact.

I think/believe that selinux and iptables are disabled and not running. So ... why is mysqld refusing connections from localhost? What should I check? What processes might cause this if a .conf file or possibly a binary was damaged? Which other log files might contain clues? I've enabled "general logging" in /etc/mysql/my.cnf, but I get no interesting or informative entries there.

Thanks, m00tpoint

share|improve this question

migrated from Oct 8 '12 at 9:19

This question came from our site for professional and enthusiast programmers.

Why are you using telnet to get to the MySQL server? Why not just use the mysql client? Also, previous questions on SO suggest this might be an iptables problem.… – Chris Henry Oct 7 '12 at 21:18

to start troubleshooting your issue, try netstat command as following:

# netstat -anp | egrep '3306.*LISTEN'
tcp        0      0      *                   LISTEN      4118/mysqld         

and/or try this:

mysql --socket=/var/lib/mysql/mysql.sock

replace /var/lib/mysql/mysql.sock with appropriate path to your mysql.sock file.

also, since you said you have phpMyAdmin running, why don't you look in and see how it's connecting to your mysqld.

possibly that binding of your mysqld is on a specific IP/interface and not on all.

share|improve this answer

Did you check the actual mysql log file?


Also maybe you reach you limit of max_connections. run this command to check out:

show variables like 'max_connections';
show status like 'Max_used_connections';

if max_connections and Max_used_connections are equal than you need to raise max_connections

share|improve this answer

Despite the fact that localhost is normally equivalent to, as far as MySQL is concerned the two are distinct entities.

The part of the Telnet log you included shows Telnet trying first to connect by name and failing. It then tried by IP address and succeeded. Despite the fact that Telnet then reported that it had connected to MySQL at localhost, the MySQL user account is apparently configured for I suspect that the two identities have been changed in some config file. I don't know postfix but I suggest you check its config. Failing that you could add a MySQL user account for

share|improve this answer
The log posted doesn't show telnet trying to connect to anything by name and failing. It does show a failure to connect to ::1, though, which is quite worrisome. – Michael Hampton Oct 8 '12 at 13:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.