SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Problem connection mysql r41-3 (https://forum.sa-mp.com/showthread.php?t=637797)

skuller12 21/07/2017 02:47 PM

Problem connection mysql r41-3
 
Hello guys, i have a problem. This problem is connection to localhost.
I have 1 warning(in warning log(mysql)) and 4 errors(in errors log(mysql))
Warning:
Code:

[17:31:15] [plugins/mysql] mysql_connect: no password specified (D:\GM\gamemodes\GM.pwn:23970 -> D:\pawno S\pawno\include\afk.inc:73 -> D:\pawno S\pawno\include\YSI\y_hooks/impl.inc:483)
I don't have a password, because i use it localhost.
And errors:
Code:

[17:31:15] [plugins/mysql] CConnection::CConnection - establishing connection to MySQL database failed: #2013 'Lost connection to MySQL server at 'reading authorization packet', system error: 10060'
[17:31:15] [plugins/mysql] CConnection::CConnection - establishing connection to MySQL database failed: #2013 'Lost connection to MySQL server at 'reading authorization packet', system error: 10060'
[17:31:15] [plugins/mysql] CConnection::CConnection - establishing connection to MySQL database failed: #2013 'Lost connection to MySQL server at 'reading authorization packet', system error: 10060'
[17:31:15] [plugins/mysql] CConnection::CConnection - establishing connection to MySQL database failed: #2013 'Lost connection to MySQL server at 'reading authorization packet', system error: 10060'

I updated the plugins and logs to R41-3
Connection code
Code:

handle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);

Details for mysql_host, etc:

#if defined Server1
        #define MYSQL_HOST                ""
        #define MYSQL_USER                ""
        #define MYSQL_PASS                ""
        #define MYSQL_DB                ""
#endif
#if defined Server2
        #define MYSQL_HOST                "localhost"
        #define MYSQL_USER                "root"
        #define MYSQL_PASS                ""
        #define MYSQL_DB                "testx"
#endif


skuller12 21/07/2017 06:19 PM

Re: Problem connection mysql r41-3
 
UP!!

skuller12 22/07/2017 06:44 AM

Re: Problem connection mysql r41-3
 
UP, I put it OnQueryError and I have errors:

Errors:
Code:

[19:02:18] Error ID: 2013 | Callback: LoadCars
[19:02:18] Error: Lost connection to MySQL server at 'reading authorization packet', system error: 10060 | Query: SELECT * FROM `cars`

And function:
Code:

mysql_tquery(haft, "SELECT * FROM `cars`", "LoadCars", "");

skuller12 23/07/2017 05:22 AM

Re: Problem connection mysql r41-3
 
UP!!

skuller12 24/07/2017 06:42 AM

Re: Problem connection mysql r41-3
 
UP!!

AjaxM 24/07/2017 07:19 AM

Re: Problem connection mysql r41-3
 
Try this.

PHP Code:

handle mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_PASSMYSQL_DB);

Details for mysql_hostetc:

#if defined Server1
    #define MYSQL_HOST         ""
    #define MYSQL_USER         ""
    #define MYSQL_PASS         " "
    #define MYSQL_DB        ""
#endif
#if defined Server2
    #define MYSQL_HOST         "localhost"
    #define MYSQL_USER         "root"
    #define MYSQL_PASS         " " // SPACE IF NO PASS
    #define MYSQL_DB        "testx"
#endif 

Also, why you have not filled up MYSQL_HOST, MYSQL_USER, MYSQL_DB and MYSQL_PASS in Server1? It's totally unnecessary, remove the whole of Server1.

skuller12 24/07/2017 08:44 AM

Re: Problem connection mysql r41-3
 
Server1 is for host, server2 is for localhost

Edit:

That's the same thing I do, the same problems

Xeon™ 24/07/2017 09:06 AM

Re: Problem connection mysql r41-3
 
Quote:

Originally Posted by skuller12 (Post 3904810)
UP, I put it OnQueryError and I have errors:

Errors:
Code:

[19:02:18] Error ID: 2013 | Callback: LoadCars
[19:02:18] Error: Lost connection to MySQL server at 'reading authorization packet', system error: 10060 | Query: SELECT * FROM `cars`

And function:
Code:

mysql_tquery(haft, "SELECT * FROM `cars`", "LoadCars", "");

can you share with us your LoadCars() callback?

skuller12 24/07/2017 09:18 AM

Re: Problem connection mysql r41-3
 
Code:

function LoadCars()
{
        new Personal_Vehicles = cache_num_rows(), id;
        for(new i = 0; i < Personal_Vehicles; i++)
        {
                cache_get_value_name_int(i, "ID", id);
                cache_get_value_name_int(i, "ID", C_DATA[id][cSQLID]);
                cache_get_value_name_int(i, "UserID", C_DATA[id][cUserID]);
                cache_get_value_name(i, "Owner", C_DATA[id][cOwner], MAX_PLAYER_NAME);
                cache_get_value_name_int(i, "Model", C_DATA[id][cModel]);
                cache_get_value_name_int(i, "Color1", C_DATA[id][cColors][0]);
                cache_get_value_name_int(i, "Color2", C_DATA[id][cColors][1]);
                cache_get_value_name_float(i, "PosX", C_DATA[id][cPos][0]);
                cache_get_value_name_float(i, "PosY", C_DATA[id][cPos][1]);
                cache_get_value_name_float(i, "PosZ", C_DATA[id][cPos][2]);
                cache_get_value_name_float(i, "PosA", C_DATA[id][cPos][3]);
                cache_get_value_name(i, "Plate", C_DATA[id][cPlate], 10);
                cache_get_value_name(i, "CarName", C_DATA[id][cDesc], 30);
                cache_get_value_name_float(i, "KM", C_DATA[id][cKM]);
                for(new m = 0; m != 17; m++)
                {
                        format(gString, 8, "Mod%d", m);
                        cache_get_value_name_int(i, gString, C_DATA[id][cMods][m]);
                }
                cache_get_value_name_int(i, "PaintID", C_DATA[id][cPaintID]);
                cache_get_value_name_int(i, "Owned", C_DATA[id][cOwned]);
                cache_get_value_name_int(i, "Locked", C_DATA[id][cLock]);
                cache_get_value_name_int(i, "Days", C_DATA[id][cDays]);
                cache_get_value_name_int(i, "Fuel", C_DATA[id][cFuel]);
                cache_get_value_name_int(i, "Insurance", C_DATA[id][cInsurance]);
                cache_get_value_name_int(i, "Price", C_DATA[id][cPrice]);
                cache_get_value_name_int(i, "Neon", C_DATA[id][cNeon]);
                cache_get_value_name_int(i, "Spawned", C_DATA[id][cSpawned]);
                if(C_DATA[id][cSpawned] != 0) C_DATA[id][cSpawned] = 0, cUpdate(id, cSpawnedx);

                Total_P_Vehs = id;
        }
}


Xeon™ 24/07/2017 09:25 AM

Re: Problem connection mysql r41-3
 
hmm, the callback is seems to be fine can you disable your firewall and try again? also what's MySQL Server are u using? "XAMPP" or ..?


All times are GMT. The time now is 02:39 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.