SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 21/05/2010, 04:49 AM   #1
cAMo
Big Clucker
 
Join Date: Dec 2007
Posts: 134
Reputation: 0
Default (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?
cAMo is offline  
Old 21/05/2010, 04:50 AM   #2
BLAbla93
Huge Clucker
 
Join Date: Jan 2009
Posts: 213
Reputation: 4
Default Re: (Error ID: 2006, MySQL server has gone away)

refresh the connection
BLAbla93 is offline  
Old 21/05/2010, 05:15 AM   #3
cAMo
Big Clucker
 
Join Date: Dec 2007
Posts: 134
Reputation: 0
Default Re: (Error ID: 2006, MySQL server has gone away)

How?

How often do you need to?

Suggestions?
cAMo is offline  
Old 21/05/2010, 05:03 PM   #4
cAMo
Big Clucker
 
Join Date: Dec 2007
Posts: 134
Reputation: 0
Default Re: (Error ID: 2006, MySQL server has gone away)

Anyone?
cAMo is offline  
Old 21/05/2010, 05:13 PM   #5
Anwix
Big Clucker
 
Anwix's Avatar
 
Join Date: Jun 2007
Posts: 130
Reputation: 0
Default 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);
   }
}
Anwix is offline  
Old 21/05/2010, 05:22 PM   #6
cAMo
Big Clucker
 
Join Date: Dec 2007
Posts: 134
Reputation: 0
Default Re: (Error ID: 2006, MySQL server has gone away)

mysql_reconnect?
cAMo is offline  
Old 21/05/2010, 06:06 PM   #7
WackoX
Guest
 
Posts: n/a
Default 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.
 
Old 21/05/2010, 06:15 PM   #8
cAMo
Big Clucker
 
Join Date: Dec 2007
Posts: 134
Reputation: 0
Default Re: (Error ID: 2006, MySQL server has gone away)

Why not reconnect though?
cAMo is offline  
Old 21/05/2010, 06:19 PM   #9
Sergei
High-roller
 
Sergei's Avatar
 
Join Date: Mar 2008
Location: Slovenia
Posts: 2,862
Reputation: 230
Default 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.
__________________
Watch out, scouts everywhere!
Sergei is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Error quite_scream Help Archive 8 10/06/2010 05:06 PM
Server log, mysql error,.. Typhome Help Archive 1 01/08/2009 10:20 AM
Server MYSQL Error: Runtime CyberGuerilla Server Support 4 29/05/2009 10:19 AM
SA-MP.com in 2005 and 2006 Eraz0r Everything and Nothing 12 02/04/2009 05:40 AM


All times are GMT. The time now is 05:49 AM.


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