11.04.2015, 13:27
(
Последний раз редактировалось MEW273; 11.04.2015 в 13:28.
Причина: updated title
)
Basically, I have created my GM and am starting with the login system, once I start my server I can successfully connect and login successfully no worries, but when I leave the game and re-connect I get an error in my MySQL log (error #2013) Lost connection to MySQL server during query
I have tried:
I found in one thread that someone recommended using separate MySQL connections for different queries, that did not work.
I tried formatting my queries without the `ID` quotes, that also did not work.
This seems to be the sequence of events that lead to the error, the full log is below in the code tag.
[17:28:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'"
[17:28:50] [DEBUG] mysql_pquery - connection: 1, query: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = 'Jason_West'", callback: "OnQueryFinish", format: "ii"
[17:28:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:28:50] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #2013) Lost connection to MySQL server during query
As you can see in the below code the exact same query as above works when first used, but will not work again.
[17:26:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'"
[17:26:50] [DEBUG] mysql_pquery - connection: 1, query: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = 'Jason_West'", callback: "OnQueryFinish", format: "ii"
[17:26:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:26:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - query was successfully executed within 290.785 milliseconds
OnQueryFinish code:
OnPlayerConnect code:
I have tried:
I found in one thread that someone recommended using separate MySQL connections for different queries, that did not work.
I tried formatting my queries without the `ID` quotes, that also did not work.
This seems to be the sequence of events that lead to the error, the full log is below in the code tag.
[17:28:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'"
[17:28:50] [DEBUG] mysql_pquery - connection: 1, query: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = 'Jason_West'", callback: "OnQueryFinish", format: "ii"
[17:28:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:28:50] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #2013) Lost connection to MySQL server during query
As you can see in the below code the exact same query as above works when first used, but will not work again.
[17:26:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'"
[17:26:50] [DEBUG] mysql_pquery - connection: 1, query: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = 'Jason_West'", callback: "OnQueryFinish", format: "ii"
[17:26:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:26:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - query was successfully executed within 290.785 milliseconds
pawn Код:
[17:26:02] [DEBUG] mysql_option - option: 1, value: 0
[17:26:02] [DEBUG] mysql_connect - host: "blurred", user: "blurred", database: "blurred", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[17:26:02] [DEBUG] CMySQLHandle::Create - creating new connection..
[17:26:02] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[17:26:02] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[17:26:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[17:26:04] [DEBUG] CMySQLConnection::Connect - connection was successful
[17:26:04] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[17:26:04] [DEBUG] mysql_errno - connection: 1
[17:26:04] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[17:26:04] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[17:26:04] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[17:26:05] [DEBUG] CMySQLConnection::Connect - connection was successful
[17:26:05] [DEBUG] CMySQLConnection::Connect - connection was successful
[17:26:05] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[17:26:05] [DEBUG] CMySQLConnection::Connect - connection was successful
[17:26:05] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[17:26:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'"
[17:26:50] [DEBUG] mysql_pquery - connection: 1, query: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = 'Jason_West'", callback: "OnQueryFinish", format: "ii"
[17:26:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:26:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - query was successfully executed within 290.785 milliseconds
[17:26:50] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[17:26:50] [DEBUG] Calling callback "OnQueryFinish"..
[17:26:50] [DEBUG] cache_get_row_count - connection: 1
[17:26:50] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[17:26:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "2"
[17:26:50] [DEBUG] cache_get_field_content - row: 0, field_name: "Username", connection: 1, max_len: 24
[17:26:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Username", data: "Jason_West"
[17:26:50] [DEBUG] cache_get_field_content - row: 0, field_name: "Password", connection: 1, max_len: 32
[17:26:50] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Password", data: "yolo"
[17:26:50] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[17:26:58] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM `accounts` WHERE `Username` = '%s'"
[17:26:58] [DEBUG] mysql_pquery - connection: 1, query: "SELECT * FROM `accounts` WHERE `Username` = 'Mitchell_Weston'", callback: "OnQueryFinish", format: "ii"
[17:26:59] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:26:59] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - query was successfully executed within 287.741 milliseconds
[17:26:59] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[17:26:59] [DEBUG] Calling callback "OnQueryFinish"..
[17:26:59] [DEBUG] cache_get_row_count - connection: 1
[17:26:59] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Admin", connection: 1
[17:26:59] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Admin", data: "7"
[17:28:50] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'"
[17:28:50] [DEBUG] mysql_pquery - connection: 1, query: "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = 'Jason_West'", callback: "OnQueryFinish", format: "ii"
[17:28:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - starting query execution
[17:28:50] [ERROR] CMySQLQuery::Execute[OnQueryFinish] - (error #2013) Lost connection to MySQL server during query
[17:28:50] [DEBUG] CMySQLQuery::Execute[OnQueryFinish] - error will be triggered in OnQueryError
pawn Код:
case THREAD_CHECK_ACCOUNT:
{
new Rows;
Rows = cache_get_row_count(gMySQL);
if(Rows)
{
PlayerData[extraid][ID] = cache_get_field_content_int(0, "ID");
cache_get_field_content(0, "Username", PlayerData[extraid][Username], gMySQL, 24);
cache_get_field_content(0, "Password", PlayerData[extraid][Password], gMySQL, 32);
new String[128];
format(String, sizeof(String), "Welcome %s. This account is registered. Please enter your password below to login.", GetPlayerRPN(extraid));
ShowPlayerDialog(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Login", "Cancel");
}
else if (!Rows)
{
}
}
pawn Код:
new PlayerName[24], Query[128];
for(new i; Account:i < Account; i++)
{
PlayerData[playerid][Account:i] = 0;
}
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
mysql_format(gMySQL, Query, sizeof(Query), "SELECT `ID`, `Username`, `Password` FROM `accounts` WHERE `Username` = '%s'", PlayerName);
mysql_pquery(gMySQL, Query, "OnQueryFinish", "ii", THREAD_CHECK_ACCOUNT, playerid);