[Help][MySQL]MySQL query unsuccessful.
#1

So um, I've got a small problem. Let me try to make it short, so here it is:

When I start the server, I get the message "[MySQL] Connection successful!" in console. But when I join the server, and try to register or something, it gives me "[MySQL] Query Unsuccessful. (blah blah blah)". No idea why. I am using G-stylz/whatever's MySQL script, and I am on debian 5. if I load 'mysql.so', I get "libmysqlclient.so.15: cannot open shared [..]", but if I load 'mysql_debian.so', I dont get any such errors. (libmysqlclient.so.15: cannot open shared [..])

Example:
Код:
[13:23:34] [MYSQL] MySQL query unsuccessful. (INSERT INTO `playerjoins` (`joinid`, `player`, `ip`, `date`) values(NULL, 'T1mm1[XA]', '127.0.0.1', NOW()))
Script:
Код:
stock LogJoin(player[], ip[])
{
   	format(szQuery, sizeof(szQuery), "INSERT INTO `playerjoins` (`joinid`, `player`, `ip`, `date`) values\
   	(NULL, '%s', '%s', NOW())", player, ip);
   	SendQuery(szQuery);
   	return true;
}
mysql_debug.txt:

Код:
[13:23:34] ---------------------------
[13:23:34] MySQL Debugging activated (12/31/11)
[13:23:34] ---------------------------
[13:23:34]  
[13:23:34] >> mysql_ping( Connection handle: 1 )
[13:23:34] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
[13:23:34] >> mysql_ping( Connection handle: 1 )
[13:23:34] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
[13:23:34] >> mysql_query( Connection handle: 1 )
[13:23:34] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)
[13:23:34] >> mysql_ping( Connection handle: 1 )
[13:23:34] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
[13:23:34] >> mysql_query( Connection handle: 1 )
[13:23:34] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)
[13:23:34] >> mysql_store_result( Connection handle: 1 )
[13:23:34] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)
[13:23:34] >> mysql_num_rows( Connection handle: 1 )
[13:23:34] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[13:23:34] >> mysql_ping( Connection handle: 1 )
[13:23:34] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
[13:32:43] >> mysql_ping( Connection handle: 1 )
[13:32:43] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
[13:32:43] >> mysql_query( Connection handle: 1 )
[13:32:43] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)
[13:32:43] >> mysql_store_result( Connection handle: 1 )
[13:32:43] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)
[13:32:43] >> mysql_num_rows( Connection handle: 1 )
[13:32:43] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[13:32:43] >> mysql_free_result( Connection handle: 1 )
[13:32:43] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)
[13:43:56] >> mysql_ping( Connection handle: 1 )
[13:43:56] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
[13:43:56] >> mysql_query( Connection handle: 1 )
[13:43:56] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)
[13:43:56] >> mysql_store_result( Connection handle: 1 )
[13:43:56] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)
[13:43:56] >> mysql_num_rows( Connection handle: 1 )
[13:43:56] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)
[13:43:56] >> mysql_free_result( Connection handle: 1 )
[13:43:56] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)
That's it.. Can you help me, please? Thank you in advance.

PS: I am using DrPepper's gm, PTPM v5.9
Reply
#2

Are you even connected to the database?
Reply
#3

I'm pretty sure I am. I've entered the host/dbname/password/username.

PS:

Код:
public mysql_start()
{
	if (mysql_connect(DBHOST, DBUSER, DBNAME, DBPASS))
	{
		mysql_debug(1);
		print("[MYSQL] Connection successful!");
	}
	else
	{
		print("[MYSQL] There was an error connecting to the MYSQL server");
		IRC_GroupSay(gGroupID, "IRC_Channel", "[MYSQL] There was an error connecting to the MYSQL server");
	}
   	return 1;
}
Reply
#4

server log?? does it actually say "[MYSQL] Connection successful!"
Reply
#5

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3d, ©2005-2011 SA-MP Team

[03:29:24] filterscripts = ""  (string)
[03:29:24] 
[03:29:24] Server Plugins
[03:29:24] --------------
[03:29:24]  Loading plugin: irc.so
[03:29:24] 

*** IRC Plugin v1.4.2 by Incognito loaded ***

[03:29:24]   Loaded.
[03:29:24]  Loading plugin: sscanf.so
[03:29:24] 

[03:29:24]  ===============================

[03:29:24]       sscanf plugin loaded.     

[03:29:24]    © 2009 Alex "******" Cole

[03:29:24]  ===============================

[03:29:24]   Loaded.
[03:29:24]  Loading plugin: mysql_debian.so
[03:29:24] 

  > MySQL plugin R6 successfully loaded.

[03:29:24]   Loaded.
[03:29:24]  Loaded 3 plugins.

[03:29:24] 
[03:29:24] Ban list
[03:29:24] --------
[03:29:24]  Loaded: samp.ban
[03:29:24] 
[03:29:24] 
[03:29:24] Filterscripts
[03:29:24] ---------------
[03:29:24]   Loaded 0 filterscripts.

[03:32:33] [MYSQL] Connection successful!
[03:32:33] ==========================================================
[03:32:33] 			game mode stuff here
[03:32:33] 			credits etc
[03:32:33] 		irc bots connected or not
[03:32:33] 		blah blah blah
[03:32:33] 		blah blah blah
[03:32:33] 		blah blah blah
[03:32:33] ==========================================================
[03:32:33] Number of vehicle models: 118
Reply
#6

mysql_connect returns the connection handle, not if it's successful or not. Use MySQL ping to check if the connection to the database was successful.
Reply
#7

Script:

Код:
public CheckSQL()
{
	new bool:connected;
	if (!mysql_ping())
	{
		connected = false;
	}
	else
	{
		connected = true;
	}
	if (connected == false)
	{
		print("[MYSQL] Lost connection to MYSQL server, Reconnecting..");
		mysql_start();
	}
	return 1;
}
mysql.txt:

Код:
[06:19:41] >> mysql_ping( Connection handle: 1 )

[06:19:41] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)
Reply
#8

put mysql_start(); in OnGameModeInit and

pawn Код:
public mysql_start()
{
    mysql_debug(1);
    if (mysql_connect(DBHOST, DBUSER, DBNAME, DBPASS))
    {
        print("[MYSQL] Connection successful!");
    }
    else
    {
        print("[MYSQL] There was an error connecting to the MYSQL server");
        IRC_GroupSay(gGroupID, "IRC_Channel", "[MYSQL] There was an error connecting to the MYSQL server");
    }
    return 1;
}
Reply
#9

Код:
[12:18:47]  

[12:18:47] ---------------------------

[12:18:47] MySQL Debugging activated (01/01/12)

[12:18:47] ---------------------------

[12:18:47]  

[12:18:47] >> mysql_connect( )

[12:18:47] CMySQLHandler::CMySQLHandler() - constructor called.

[12:18:47] CMySQLHandler::CMySQLHandler() - Connecting to "176.9.81.250" | DB: "derp_ptpm" | Username: "derp_ptpm" ...

[12:19:08] CMySQLHandler::Connect() - Lost connection to MySQL server during query (Error ID: 2013)

[12:19:08]  

[12:19:08] ---------------------------

[12:19:08] MySQL Debugging activated (01/01/12)

[12:19:08] ---------------------------

[12:19:08]  

[12:19:08]  

[12:19:08] ---------------------------

[12:19:08] MySQL Debugging activated (01/01/12)

[12:19:08] ---------------------------

[12:19:08]  

[12:19:08] >> mysql_connect( )

[12:19:29] CMySQLHandler::Connect() - Lost connection to MySQL server during query (Error ID: 2013)

[12:21:22]  

[12:21:22] ---------------------------

[12:21:22] MySQL Debugging activated (01/01/12)

[12:21:22] ---------------------------

[12:21:22]  

[12:21:22] >> mysql_ping( Connection handle: 1 )

[12:21:22] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:22] >> mysql_ping( Connection handle: 1 )

[12:21:22] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:22] >> mysql_query( Connection handle: 1 )

[12:21:22] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[12:21:22] >> mysql_ping( Connection handle: 1 )

[12:21:22] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:22] >> mysql_query( Connection handle: 1 )

[12:21:22] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[12:21:22] >> mysql_store_result( Connection handle: 1 )

[12:21:22] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[12:21:22] >> mysql_num_rows( Connection handle: 1 )

[12:21:22] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[12:21:22] >> mysql_ping( Connection handle: 1 )

[12:21:22] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:37]  

[12:21:37] ---------------------------

[12:21:37] MySQL Debugging activated (01/01/12)

[12:21:37] ---------------------------

[12:21:37]  

[12:21:37] >> mysql_ping( Connection handle: 1 )

[12:21:37] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:37] >> mysql_ping( Connection handle: 1 )

[12:21:37] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:37] >> mysql_query( Connection handle: 1 )

[12:21:37] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[12:21:37] >> mysql_ping( Connection handle: 1 )

[12:21:37] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:21:37] >> mysql_query( Connection handle: 1 )

[12:21:37] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[12:21:37] >> mysql_store_result( Connection handle: 1 )

[12:21:37] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[12:21:37] >> mysql_num_rows( Connection handle: 1 )

[12:21:37] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[12:21:37] >> mysql_ping( Connection handle: 1 )

[12:21:37] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[12:23:12] CMySQLHandler::~CMySQLHandler() - deconstructor called.

[12:23:12] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)

[12:23:12] CMySQLHandler::Disconnect() - You cannot call this function now. (Reason: Connection is dead)
Still no luck. :<
Reply
#10

And now you should change the password at your MySQL server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)