SA-MP Forums Archive
Mysql error :( - 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: Mysql error :( (/showthread.php?tid=550513)



Mysql error :( - Kruno88 - 13.12.2014

Код:
[11:13:59]  Can't connect to MySQL Database | Trying Again !
[11:14:00] Can't connect to MySQL Database | Server Closed !
.....
  > MySQL plugin unloaded.
Anyone can help me?


Re: Mysql error :( - Galletziz - 13.12.2014

show your portion code where you try to connect at database.


Re: Mysql error :( - Kruno88 - 13.12.2014

Код:
#define SQL_HOST   "127.0.0.1"
#define SQL_USER   "root"
#define SQL_PASS   ""
#define SQL_DATA   "dayzdb"



Re: Mysql error :( - Sparke - 13.12.2014

Are you sure that's your db name and such? try putting it as localhost instead of 127.0.0.1

E: Do you have PHPMyAdmin open?


Re: Mysql error :( - Kruno88 - 13.12.2014

Quote:
Originally Posted by Sparke
Посмотреть сообщение
Are you sure that's your db name and such? try putting it as localhost instead of 127.0.0.1

E: Do you have PHPMyAdmin open?
Doesn't work


Re: Mysql error :( - Galletziz - 13.12.2014

pawn Код:
new db_connect;

//OnGameModeInit()..

db_connect = mysql_connect("localhost","root","dayzdb","");
Try this without define costants..


Re: Mysql error :( - Kruno88 - 13.12.2014

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
pawn Код:
new db_connect;

//OnGameModeInit()..

db_connect = mysql_connect("localhost","root","dayzdb","");
Try this without define costants..
I get 4 errors.


Re: Mysql error :( - Galletziz - 13.12.2014

What errors? :\


Re: Mysql error :( - Kruno88 - 13.12.2014

Quote:
Originally Posted by Galletziz
Посмотреть сообщение
What errors? :\
Код:
C:\Users\Andrijana\Desktop\HDRP\gamemodes\dayzstandalone.pwn(2011) : error 010: invalid function or declaration
C:\Users\Andrijana\Desktop\HDRP\gamemodes\dayzstandalone.pwn(3484) : error 017: undefined symbol "SQL_HOST"
C:\Users\Andrijana\Desktop\HDRP\gamemodes\dayzstandalone.pwn(3492) : error 017: undefined symbol "SQL_HOST"
C:\Users\Andrijana\Desktop\HDRP\gamemodes\dayzstandalone.pwn(3896) : warning 203: symbol is never used: "db_connect"
Код:
3492:        mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
3484:     mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
203: }
2011: db_connect = mysql_connect("localhost","root","dayzdb","");

stock Connect_To_Database(){
    mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
    if(mysql_ping() == 1){
        print("[DayZ - MySQL] Connect to MySQL Database successfully !");
        return true;
	}
    else
    {
        print("[DayZ - MySQL] Can't connect to MySQL Database | Trying Again !");
        mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
        if(mysql_ping() == 1){
            print("[DayZ - MySQL] Connect to MySQL Database successfully !");
            return true;
        }
        else{
			print("[DayZ - MySQL] Can't connect to MySQL Database | Server Closed !");
            SendRconCommand("exit");
            return true;
        }
    }
}



Re: Mysql error :( - Kruno88 - 13.12.2014

I have no errors in Pawno but it still fails to connect to Mysql database.
I fixed those.