| View previous topic :: View next topic |
| Author |
Message |
ultralord Master

Joined: 06 Nov 2006 Posts: 255
|
Posted: Wed Sep 15, 2010 7:06 am Post subject: mysql server gone away |
|
|
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? _________________
You need a iRC bot for your CS Gameserver? Rent one here |
|
| Back to top |
|
 |
thommey Halfop
Joined: 01 Apr 2008 Posts: 73
|
Posted: Wed Sep 15, 2010 7:56 am Post subject: |
|
|
Let your mysql database handle be in the global $dbhandle variable.
| Code: |
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. |
|
| Back to top |
|
 |
ultralord Master

Joined: 06 Nov 2006 Posts: 255
|
Posted: Thu Sep 16, 2010 6:30 am Post subject: |
|
|
ahhh it was easy thanks for great help  _________________
You need a iRC bot for your CS Gameserver? Rent one here |
|
| Back to top |
|
 |
ultralord Master

Joined: 06 Nov 2006 Posts: 255
|
Posted: Fri Sep 17, 2010 10:19 am Post subject: |
|
|
cant find the correct args
Tcl error [checksqlalive]: wrong # args: should be "checksqlalive"
:S _________________
You need a iRC bot for your CS Gameserver? Rent one here |
|
| Back to top |
|
 |
thommey Halfop
Joined: 01 Apr 2008 Posts: 73
|
Posted: Fri Sep 17, 2010 6:13 pm Post subject: |
|
|
woops, sorry, should've been:
| Code: |
bind time - * checksqlalive
proc checksqlalive {args} {
mysql::ping $::dbhandle
}
|
|
|
| Back to top |
|
 |
kenh83 Halfop
Joined: 08 Sep 2010 Posts: 61
|
Posted: Fri Feb 04, 2011 1:39 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|