PDA

View Full Version : Problem with MySQL.


tsonn1
05/10/2012, 04:28 PM
Hi!

I've got a little problem with mysql. I'm using the mysql plugin R6.
Here's the server log:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e, (C)2005-2012 SA-MP Team

[20:38:28]
[20:38:28] Server Plugins
[20:38:28] --------------
[20:38:28] Loading plugin: mysql.so
[20:38:28]

> MySQL plugin R6 successfully loaded.

[20:38:28] Loaded.
[20:38:28] Loading plugin: sscanf.so
[20:38:28]

[20:38:28] ===============================

[20:38:28] sscanf plugin loaded.

[20:38:28] (c) 2009 Alex "******" Cole

[20:38:28] 0.3d-R2 500 Players "dnee"

[20:38:28] ===============================

[20:38:28] Loaded.
[20:38:28] Loading plugin: streamer.so
[20:38:28]

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[20:38:28] Loaded.
[20:38:28] Loaded 3 plugins.

[20:38:28]
[20:38:28] Filterscripts
[20:38:28] ---------------
[20:38:28] Loading filterscript 'Raadio.amx'...
[20:38:28] Unable to load filterscript 'Raadio.amx'.
[20:38:28] Loaded 0 filterscripts.

[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:38:30] Bizzes updated, (2215)
[20:38:30] Houses updated, (2276)
[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:38:30] Bizzes updated, (2215)
[20:38:30] Houses updated, (2276)
[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:38:30] Bizzes updated, (2215)
[20:38:30] Houses updated, (2276)
[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:38:30] Bizzes updated, (2215)
[20:38:30] Houses updated, (2276)
[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:38:30] Bizzes updated, (2215)
[20:38:30] Houses updated, (2276)
[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:38:30] Bizzes updated, (2215)
[20:38:30] Houses updated, (2276)
[20:38:28] MYSQL: Trying to connect to server...
[20:38:28] MYSQL: Error. Trying again...
[20:38:28] MYSQL: Couldn't connect to server.
[20:38:28] Gameode - On
[20:38:28] _____________________________
[20:38:28] 162 cars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 50 bikes loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 0 aCars loaded. (MySQL)
[20:38:28] _____________________________
[20:38:28] 9 caravans loaded. (MySQL)
[20:38:28] _____________________________
[20:38:29] 3 aHelis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 14 boats loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 11 helis loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 39 bizzes loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 109 houses loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] 5 points loaded. (MySQL)
[20:38:29] _____________________________
[20:38:29] Pickups limit = 400, Pickups loaded = 4
[20:38:30]
[20:38:30] GM
[20:38:30] _____________________________
[20:38:30]
[20:38:30] Number of vehicle models: 103
[20:41:33] MYSQL: Connection dead. Reconnecting...
See - The server just keeps restarting. (I removed a couple of lines)
(Don't mind the times. :D I translated the text, so everything is 20:38:30. ;))


Here's the thing causing this:
public MySQLConnect(sqlhost[], sqluser[], sqlpass[], sqldb[]) // by Luk0r
{
print("MYSQL: Trying to connect to server...");
mysql_connect(sqlhost, sqluser, sqldb, sqlpass);
if(mysql_ping()==0)
{
print("MYSQL: Connection successful.");
return 1;
}
else
{
print("MYSQL: Error. Trying again...");
mysql_connect(sqlhost, sqluser, sqldb, sqlpass);
if(mysql_ping()==0)
{
print("MYSQL: Reconnection success! Continuing normally.");
return 1;
}
else
{
print("MYSQL: Couldn't connect to server.");
return 0;
}
}
}

public MySQLDisconnect() // by Luk0r
{
mysql_close();
return 1;
}

public MySQLCheckConnection() // by Luk0r
{
if(mysql_ping()==0)
{
return 1;
}
else
{
print("MYSQL: Connection dead. Reconnecting...");
MySQLDisconnect();
MySQLConnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQ L_DB);
if(mysql_ping()==0)
{
print("MYSQL: Reconnection success! Continuing normally.");
return 1;
}
else
{
print("MYSQL: Couldn't connect to server.");
return 0;
}
}
}


About the host: OS - Debian 5

Red_Dragon.
05/10/2012, 04:46 PM
Post in non English section please

tsonn1
05/10/2012, 05:49 PM
Moment. I'll translate it. ;)

tsonn1
05/10/2012, 06:59 PM
Translated. ;)

Waiting for response. (+rep) :)

Mean
05/10/2012, 09:28 PM
Kind of a beginner question but: your databases are all set up?

tsonn1
06/10/2012, 06:45 AM
Of course. :D
It worked with the old sampmysql plugin, but after the upgrade to BlueG's MySQL plugin, I keep having this problem.

tsonn1
06/10/2012, 10:25 AM
And also.. Mysql doesn't load some stuff. I think, it's caused by the removal of samp_mysql_strtok.

Unfriendly
06/10/2012, 02:09 PM
With the update to R7 you're gonna need to rewrite a lot of your code.
I would suggest staying with R6 until you can update the code, just to keep your server online.

Also make sure your mysql database has direct access allowed.

tsonn1
06/10/2012, 03:32 PM
No no...
I had an old MySQL plugin. I think it was R2 or smthing like this.
Now I updated it to R6.

tsonn1
07/10/2012, 03:27 PM
Bump!

tsonn1
10/10/2012, 03:55 PM
Bump!

TzAkS.
10/10/2012, 04:08 PM
Are you trying to conect on localhost or to a 'webhost'?
And here

if(mysql_ping()==0)
{
print("MYSQL: Connection successful.");
return 1;
}

It should be

if(mysql_ping()==1)
{
print("MYSQL: Connection successful.");
return 1;
}

The mysql is conecting corectly but you have another problem for restart.

tsonn1
10/10/2012, 04:12 PM
I'm trying to connect to a 'webhost'. :)

The problem was, that if the ping was 0, mysql reconnected. :D

tsonn1
10/10/2012, 04:26 PM
The problem wasn't in MySQL... Server doesn't even start. Just connects to MySQL...