Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a dedicated webserver and a dedicated database server

Often , i got errors connecting to database server

couldn't connect to database

Here is my current /etc/my.cnf configuration file

[mysqld]
local-infile=0
innodb_file_per_table=1
max_allowed_packet = 100M

log-slow-queries=/var/log/slow.log

open_files_limit=7306
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
nice = -10

How Can I increase the timeout connect for the database server ?

share|improve this question

1 Answer 1

Actually I do not think this is something you would want to change under nearly any circumstances. You should not fix the symptom, but should find out the problem.

Does the mysql log contains information about aborted connections? Does the syslog of that server contain information which might be relevant? Do you run a more or less decent version of mysql? (At least the most current minor version.) Have you checked if the database server runs out of resources (e.g. RAM, because swapping is really bad for any DB server)? Have you compared the number of connections your webserver maximally issues simultaneously to the db server and the number of connections your db server is processing in parallel from its configuration file?

Have you tried pinging the database server from the web server for a long period of time? Does the ping slows down (or gets lost) too, when the error message pops up in your application?

You should check all that before you change anything in timeouts.

share|improve this answer

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.