(Error ID: 2006, MySQL server has gone away)
#1

Quote:

(Error ID: 2006, MySQL server has gone away)

I login to my server and MySQL works properly. If I leave my server set for 24 hours (or extended time), MySQL comes back with an error and says that the connection is dead.

Why is this happening? How do I keep the connection/reestablish it?
Reply
#2

refresh the connection
Reply
#3

How?

How often do you need to?

Suggestions?
Reply
#4

Anyone?
Reply
#5

A quick way would be to set a timer that checks the connection of the mysql every 5-10minutes.

pawn Code:
forward CheckMySQL();
public CheckMySQL()
{
   if (!mysql_ping())
   {
     mysql_connect(host, user, database, pass);
   }
}
Reply
#6

mysql_reconnect?
Reply
#7

pawn Code:
forward CheckMySQL();
public CheckMySQL()
{
   if (!mysql_ping())
   {
     mysql_connect(host, user, database, pass);
   }
}
So that means put CheckMySQL(); on top of all functions which contains queries.
Reply
#8

Why not reconnect though?
Reply
#9

@WackoX, if you know nothing about that plugin please DO NOT suggest stupid things. CheckMySQL() or other idiotic functions were using in the era of Adrenaline's plugin. I thought we have already gone over that.

@cAMo, this is in no way scripting discussion, so keep it in plugin's topic and not on two different places.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)