Database Setup

ID #1055

How do I stop my long-running app from periodically disconnecting from MySQL?

MySQL connections timeout after a default of 8 hours, so this is the most likely cause of why MySQL just appears to disappear. There are two immediate solutions:

  1. Teach your app how to reconnect to the database. If it can detect a connection failure, it can try and reconnect and resume doing its work (though, it is good to distinguish between a more serious error and this periodic problem).
  2. If your app is a rails app (for instance), set up a cron job to hit one of your lightweight database enabled pages every 7 hours. Doing so will effectively ping the MySQL server, and keep the connection alive.
Categories for this entry

Tags: -

Related entries:

Last update: 2006-04-04 15:39
Author: Dave Steinberg
Revision: 1.0

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry