MySQL Connection
#1

Hello there, I noticed this happened to my SAMP server:

Код:
Error ID: 2006, MySQL server has gone away
As I understood its because SAMP server has disconnected. I also saw some of helps for that but i don't want to use mysql_ping() function because it could cause server freeze. I also made timer every 3 minutes that run some query just to keep connection alive, but still it happened. And to add SAMP server and MySQL server are not on same machine. So I connect to remote server.
Reply
#2

Ping the MySQL server from the server you're running SA:MP on. What is the response?
Reply
#3

IDK WHY but i cant connect to my server bcoz that said ur name registered ,, but i didnt if u can help me thanks
(thats full my sql and u use mysql r5
Reply
#4

This happened to me. The connection would get alive, and then die for some unknown reason. I found out it was a wrong query doing this.
Reply
#5

Make sure you close the mysql connection after you perform a query statment, and also make sure that there are no mistakes in your query's.

Make sure you have an up to date plugin and that you may need to perform a debug test. Meaning for each query "Print" the results and see if any errors come up.

Hope this helps.
Reply
#6

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Make sure you close the mysql connection after you perform a query statment
If you do this you'll be in for A LOT of lag. Continuesly connecting and disconnecting to a database is very slow. You only need to connect and disconnect once, which is during OnGameModeInit() and OnGameModeExit().

Check all your queries for mistakes (use mysql_debug(1) to check them), incase you can't find the error and want to brute-force the connection into working you can use something like this in a loop:

pawn Код:
if(!mysql_ping()) {
    mysql_connect();
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)