SA-MP Forums Archive
MySQL Connection - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL Connection (/showthread.php?tid=225338)



MySQL Connection - Criss_Angel - 13.02.2011

Okay, My Server is hosted on this ip : server.ip.here
My Website & SQL server are here: website.sql.ip
I connect via mysql_connect("website.sql.ip","user","password"," db");
But on the logs it fails to connect and shows this:
Acces denied. 'user@server.ip.here', meaning that its connecting to localhost instead of the IP of my sql server.Why is this?


Re: MySQL Connection - Criss_Angel - 16.02.2011

BUMP, I still need help.For some reason its connecting to my localhost instead of the IP


Re: MySQL Connection - playbox12 - 16.02.2011

How can we help you with you showing us code? Show your connection defines (if you have them) and the mysql_connect(); under OnGameModeInit().


Re: MySQL Connection - Sergei - 16.02.2011

You probably you MySQL plugin? Go and post in its topic


Re: MySQL Connection - Criss_Angel - 16.02.2011

Im using StrickenKid's Here is on Gamemode init:
pawn Код:
mysql_init();
    if(!mysql_connect("localhost", "rayyan","lolk","rayyan_westside"))
    {
       print("\n MySQL Connection Failed, Now on Offline Mode\n");
       Offline = 1;
       mysql_close();
    }
    else
    {
      SetTimer("ServerUpdate",120000, true);
      Offline = 0;
    }
    SetGameModeText("WS-RPG2");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       BankTimer = SetTimerEx("BankCheck", 1000, true, "i", i);
       timetimer = SetTimerEx("TimeUpdate", 60000, true, "i", i);
       SetTimer("LoadCars", 2500, false);
       //SetTimerEx("IsAtGasStation",2000,1,"i",i);
    }
Compiled fine, just 24 loose indention warnings on my add static vehicles.


Re: MySQL Connection - Criss_Angel - 16.02.2011

Okay I'm a retard, Resolved.I didnt edit the localhost, Epic Fail.


Re: MySQL Connection - Calgon - 16.02.2011




Re: MySQL Connection - Criss_Angel - 16.02.2011

Heheh.
Well now, i checked and the SQL Connects, but on my server console it says Error: mysql has gone away.Why does it keep loosing connection?How can i prevent this?