Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

UPDATE

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

[mysqld]
set-variable=local-infile=0
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
max_connections=700

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

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

Thanks.

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

1 Answer 1

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

 
discard

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.