SA-MP Forums Archive
Mysql Database wont connect - 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 Database wont connect (/showthread.php?tid=616185)



Mysql Database wont connect - ThatFag - 01.09.2016

hej
i recently got a mysql gm and im working with it now the problem is that the gamemode wont connect to MYSQL and gamemode shows "unknown".

here is script of connection to mysql
Код:
stock ConnectToDatabase()
{
	printf("[ConnectToMainPipeline:] Connecting to %s...", SQL_DATA);
	mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);

	MySQLPipeline = mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS, 3306, true, 2);
	if(mysql_errno(MySQLPipeline) != 0)
	{
		printf("[MySQL] (MySQLPipeline) Fatal Error! Could not connect to MySQL: Host %s - DB: %s - User: %s", SQL_HOST, SQL_DATA, SQL_USER);
		print("[MySQL] Note: Make sure that you have provided the correct connection credentials.");
		printf("[MySQL] Error number: %d", mysql_errno(MySQLPipeline));
		SendRconCommand("exit");
	}
	return 1;
}
ongamemode int

Код:
ConnectToDatabase();
defines
Код:
#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_PASS ""
#define SQL_DATA "testt"