SA-MP Forums Archive
Problem with MySQL. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with MySQL. (/showthread.php?tid=382903)



Problem with MySQL. - tsonn1 - 05.10.2012

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, ©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]    © 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. I translated the text, so everything is 20:38:30. )


Here's the thing causing this:
pawn Код:
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,MYSQL_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


Re: Problem with MySQL. - Red_Dragon. - 05.10.2012

Post in non English section please


Re: Problem with MySQL. - tsonn1 - 05.10.2012

Moment. I'll translate it.


Re: Problem with MySQL. - tsonn1 - 05.10.2012

Translated.

Waiting for response. (+rep)


Re: Problem with MySQL. - Mean - 05.10.2012

Kind of a beginner question but: your databases are all set up?


Re: Problem with MySQL. - tsonn1 - 06.10.2012

Of course.
It worked with the old sampmysql plugin, but after the upgrade to BlueG's MySQL plugin, I keep having this problem.


Re: Problem with MySQL. - tsonn1 - 06.10.2012

And also.. Mysql doesn't load some stuff. I think, it's caused by the removal of samp_mysql_strtok.


Re: Problem with MySQL. - Unfriendly - 06.10.2012

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.


Re: Problem with MySQL. - tsonn1 - 06.10.2012

No no...
I had an old MySQL plugin. I think it was R2 or smthing like this.
Now I updated it to R6.


Re: Problem with MySQL. - tsonn1 - 07.10.2012

Bump!