This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

mysql server gone away

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

mysql server gone away

Post by ultralord »

hello i make my script but days now i have that problem when i run the proc sometimes not always it says on telnet

::mysql::sel/db server: MySQL server has gone away

after .rehash is working of course does anyone now how i can fix it.. or make .rehash if that problem appear?
Image
You need a iRC bot for your CS Gameserver? Rent one here
t
thommey
Halfop
Posts: 76
Joined: Tue Apr 01, 2008 2:59 pm

Post by thommey »

Let your mysql database handle be in the global $dbhandle variable.

Code: Select all

bind time - * checksqlalive
proc checksqlalive {} {
  mysql::ping $::dbhandle
}
That will not only check if the connection is alive every minute but also automatically reconnect if it timed out. (Alternatively, do that before every sql statement you execute). See also mysql reference manual.
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Post by ultralord »

ahhh it was easy :P thanks for great help ;)
Image
You need a iRC bot for your CS Gameserver? Rent one here
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Post by ultralord »

cant find the correct args

Tcl error [checksqlalive]: wrong # args: should be "checksqlalive"

:S
Image
You need a iRC bot for your CS Gameserver? Rent one here
t
thommey
Halfop
Posts: 76
Joined: Tue Apr 01, 2008 2:59 pm

Post by thommey »

woops, sorry, should've been:

Code: Select all

bind time - * checksqlalive 
proc checksqlalive {args} { 
  mysql::ping $::dbhandle 
} 
k
kenh83
Halfop
Posts: 61
Joined: Wed Sep 08, 2010 11:22 am

Post by kenh83 »

thommey ..
The checksqlalive snipplet, can you expand on it so that if it returns 1, it does nothing, if it returns NOTHING it would restart the mysql server.
Post Reply