SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Help Archive (https://forum.sa-mp.com/forumdisplay.php?f=89)
-   -   (Error ID: 2006, MySQL server has gone away) (https://forum.sa-mp.com/showthread.php?t=149198)

cAMo 21/05/2010 04:49 AM

(Error ID: 2006, MySQL server has gone away)
 
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?

BLAbla93 21/05/2010 04:50 AM

Re: (Error ID: 2006, MySQL server has gone away)
 
refresh the connection

cAMo 21/05/2010 05:15 AM

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

How often do you need to?

Suggestions?

cAMo 21/05/2010 05:03 PM

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

Anwix 21/05/2010 05:13 PM

Re: (Error ID: 2006, MySQL server has gone away)
 
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);
   }
}

cAMo 21/05/2010 05:22 PM

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

WackoX 21/05/2010 06:06 PM

Re: (Error ID: 2006, MySQL server has gone away)
 
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.

cAMo 21/05/2010 06:15 PM

Re: (Error ID: 2006, MySQL server has gone away)
 
Why not reconnect though?

Sergei 21/05/2010 06:19 PM

Re: (Error ID: 2006, MySQL server has gone away)
 
@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.


All times are GMT. The time now is 02:10 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.