server not connecting to mysql server
#2

The first step would be to add a print message to your script that will execute if the connection is not successful.

The code I use is similar to below:
Код:
ConnectSQLDatabase()
{
	new MySQLOpt:options_id = mysql_init_options();
	mysql_set_option(options_id, AUTO_RECONNECT, false);

	SQL_HANDLE = mysql_connect(SQL_HOSTNAME, SQL_USERNAME, SQL_PASSWORD, SQL_DATABASE, options_id);
	if(mysql_errno(SQL_HANDLE) != 0 || SQL_HANDLE == MYSQL_INVALID_HANDLE)
	{
	    print("\n----------------------------------------------------");
		print("[ERROR] Cannot establish connection to MySQL database!");
		printf("[MYSQL] ERROR CODE: %d", mysql_errno(SQL_HANDLE));
		print("----------------------------------------------------");
	}
	else
	{
	    print("[MYSQL] Connection to MySQL database established successfully!");
	}
	return 1;
}
As you stated in your OP you should definitely confirm the connection details as being correct.
Reply


Messages In This Thread
server not connecting to mysql server - by Hypex - 01.01.2018, 04:20
Re: server not connecting to mysql server - by MEW273 - 01.01.2018, 04:22
Re: server not connecting to mysql server - by Hypex - 01.01.2018, 04:23
Re: server not connecting to mysql server - by MEW273 - 01.01.2018, 04:24
Re: server not connecting to mysql server - by Hypex - 01.01.2018, 04:37
Re: server not connecting to mysql server - by MEW273 - 01.01.2018, 04:45
Re: server not connecting to mysql server - by Hypex - 01.01.2018, 04:51
Re: server not connecting to mysql server - by MEW273 - 01.01.2018, 04:57
Re: server not connecting to mysql server - by Hypex - 01.01.2018, 05:02
Re: server not connecting to mysql server - by MEW273 - 01.01.2018, 05:09

Forum Jump:


Users browsing this thread: 3 Guest(s)