So i’ve recently stated using GForum and Sourcebans on my servers they work great! But theres a problem, About 15 minutes after you start up the server this happens:

Sourcebans Error:

[04/14/15 10:55:22][SourceBans.lua] The server has lost connection to the database. Retrying...

GForum Error:

Query1 errored!
Query:MySQL server has gone away

And those will just spam the console and both addons stop working, Is there someway to fix this?

(by the way i’m using HostGator business plan for my website and a OVH 6 core VPS for my servers if that means anything.)

Are you managing your own MySQL server? If so then check through

HostGator manages it, all i can do is create databases and database users

You probably haven’t allowed your database to allow external connections.

Oops I was wrong, didn’t notice you had been able to connect to it for some time.

I would suggest sending a message to HostGator, asking if they can configure it properly, and if not that, reconnect to it every time it shuts off.

It’s not 100% guaranteed to be the mysql server that’s causing problems, it seems to be an issue that happens a lot to mysqloo.

What I basically did was redo the mysql code I used so it was more resilient to these problems, it will recover automatically and try again.

How would i do that?

Redo the mysql code? I never heard about that yet. How can that be done?

Most of the time a simple keepalive will prevent this. Just run a dummy query that does nothing every 30 seconds or so.

MySQLOO doesn’t allow persistent connections if I recall correctly… I’d recommend using TMySQL and ALWAYS use a wrapper so switching between plugins is easy.

TMySQL, by default, will return numerically indexed results, simply add: QUERY_FLAG_ASSOC to after the callback so: DATABASE:Query( “query”, function( _row ) …callback… end, QUERY_FLAG_ASSOC );

Then they’ll be indexed using the string name of the columns just like MySQLOO does.

You’ll also need to ensure your host allows persistent connections ( If they allow remote, then typically persistent is also allowed )…