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

We are running MySQL 5.1.33 on FreeBSD 7.2-RELEASE.

This is a development database server attached to a development webserver running Silverstripe and PHP 5.3.

This morning, the development webserver was complaining that it could not connect to the database server. The PHP error was the "Can't connect to MySQL server on ''".

We discovered that there are thousands of open files on the Database server, which is also unusual considering this server is mostly idle.

# lsof |grep /var/db/mysql/DATABASE  |wc -l

There are also thousands of connections in TIME_WAIT status, which is unusual. I am expecting these TIME_WAIT connections to time out, but they haven't ended in the last 20 minutes.

# netstat -an | grep 3306 | grep -c TIME_WAIT 

There don't seem to much activity happening on the database server:

# mysql -e "show full processlist;"
| Id   | User | Host      | db   | Command | Time | State | Info                  |
| 2489 | root | localhost | NULL | Query   |    0 | NULL  | show full processlist | 

My question: From within MySQL, how can I tell what is holding on to these files? Maybe the open files are a red herring.

share|improve this question
up vote 0 down vote accepted

It turns out that this problem was caused by a faulty localhost firewall. mysql clients were able to connect initially (or make some connections), but subsequent packets were being ignored.

I'm still trying to figure out about the open-files, but that problem has gone away.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.