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

I have a web app and sometimes I start receiving PHP error failures ("Unable to connect to MySQL server") and after a while it gets resolved.

MaxConnection set in my.cnf is 750

Is there any log or way to learn why MySQL server gets down (or is it reaching connection limit?)?

Any help is appreciated, thanks!


After reading Warner's answer below, checked my.cnf file and tried to find the error log but it doesn't exist.

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).



Can I just add log-error=/var/log/mysqld.log to [mysqld] group?


share|improve this question
Look for the file in /var/lib/*.err – Warner Jul 22 '10 at 21:14

The location of the log file is specified via two methods. The first is at run time with --log-error=filename, which would often be specified in your init file. More commonly, it would be specified in your my.cnf with log-error. Ultimately if left unset, it defaults to the data directory as your hostname.err.

Search the filesystem for a file with the extension of .err. Chances are, you'll find the log.

find / -name '*.err'
locate .err | egrep '.err$'

Your application will log when MySQL hits connection limits. Otherwise, you will need to look at the processlist. You can do this by running show full processlist; in the MySQL client. The row count will reflect the current quantity of connections.

share|improve this answer
Warner, thanks for your answer. I just updated my question above, could you please help? – Willy Jul 22 '10 at 20:59

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.