SA-MP Forums Archive
MySQL R40 Can't 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 R40 Can't Connect (/showthread.php?tid=618968)



MySQL R40 Can't Connect - Novacaine - 12.10.2016

Hello everyone,

I was using the old version of BlueG's MySQL (r20) and I had no problem with connection or anything. But i decided to update MySQL version. And it came with connection problem. I'm using that code;

Код:
new MySQL:mysqlConn;

public OnGameModeInit() 
{ 
	print("[MySql] Connecting to database...");

	mysqlConn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS, SQL_DATABASE);
	mysql_log(ALL); 

	if (mysql_errno(mysqlConn) != 0)
	{
		print("[MySql] Connected!");
	}
	else
	{
		print("[MySql] Connection Failed!");
	}
	
    return 1; 
}
When I start the server, it logs "Connection failed!". But with the older versions of MySQL plugin, I have no problem.

What could be causing this?


Re: MySQL R40 Can't Connect - azzerking - 12.10.2016

Question

Have you made sure that all the details are correct, and since updating have you changed any mysql settings that relate to the user of the mysql account?

Also what does the mysql log say?


Re: MySQL R40 Can't Connect - Konstantinos - 12.10.2016

https://sampwiki.blast.hk/wiki/MySQL/R40#mysql_errno

If it returns 0, there are no errors - you have it the other way around.


Re: MySQL R40 Can't Connect - Novacaine - 12.10.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/MySQL/R40#mysql_errno

If it returns 0, there are no errors - you have it the other way around.
Ohh thank you so much. I've been eating myself for days to find that freaking error. Whereas there was no errors