SA-MP Forums Archive
Can't connect to mysql host - 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: Can't connect to mysql host (/showthread.php?tid=286585)



Can't connect to mysql host - Baboon - 29.09.2011

Well I can't connect to my host.
Is something wrong?

Код:
#define mysql_host             "s1.hostingtime.de"//the IP of the host, should be displayed when created a database
#define mysql_user             "db223"//database username
#define mysql_password         "secret :D"//database password
#define mysql_database         "db223"//database name
Код:
public OnFilterScriptInit()
{
	print("DutchAdmin System has loaded!");
 	mysql_debug(1);
	for(new x = 0; x < 3; x++)
	{
	    mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
	    if(mysql_ping() == -1) printf("MySQL connection attempt %d failed!", x);
	    else
		{
		    print("succes");
			break;
		}
	}
	format(Query,sizeof(Query), "CREATE TABLE IF NOT EXISTS `Users` ("\
              "`Username` varchar(24) NOT NULL,"\
              "`Password` varchar(64) NOT NULL,"\
              "`IP` varchar(16) NULL,"\
              "`Money` int(15) NULL,"\
              "`Score` int(15) NULL,"\
              "`Kills` int(15) NULL,"\
              "`Deaths` int(15) NULL,"\
              "`Viplevel` int(15) NULL,"\
              "`Adminlevel` int(15) NULL,"\
              "`Banned` int(15) NULL,"\
              "PRIMARY KEY (`Username`)"\
           );
    mysql_query(Query);
    mysql_free_result();
	return 1;
}



Re: Can't connect to mysql host - Salmon - 29.09.2011

either your username, password, database, or hostname is wrong.

or there is a firewall.

take your pick


Re: Can't connect to mysql host - Cyanide - 29.09.2011

What does your mysql log print?


Re: Can't connect to mysql host - Baboon - 30.09.2011

[15:19:09] ---------------------------

[15:19:09] MySQL Debugging activated (09/30/11)

[15:19:09] ---------------------------

[15:19:09]

[15:19:09] >> mysql_connect( )

[15:19:09] CMySQLHandler::CMySQLHandler() - constructor called.

[15:19:09] CMySQLHandler::CMySQLHandler() - Connecting to "s1.hostingtime.de" | DB: "db223" | Username: "db223" ...

[15:19:10] CMySQLHandler::Connect() - Can't connect to MySQL server on 's1.hostingtime.de' (10061) (Error ID: 2003)

[15:19:10] >> mysql_ping( Connection handle: 1 )

[15:19:10] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[15:19:10] >> mysql_connect( )

[15:19:11] CMySQLHandler::Connect() - Can't connect to MySQL server on 's1.hostingtime.de' (10061) (Error ID: 2003)

[15:19:11] >> mysql_ping( Connection handle: 1 )

[15:19:11] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[15:19:11] >> mysql_connect( )

[15:19:12] CMySQLHandler::Connect() - Can't connect to MySQL server on 's1.hostingtime.de' (10061) (Error ID: 2003)

[15:19:12] >> mysql_ping( Connection handle: 1 )

[15:19:12] CMySQLHandler::Ping() - You cannot call this function now. (Reason: Dead Connection)

[15:19:12] >> mysql_query( Connection handle: 1 )

[15:19:12] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[15:19:12] >> mysql_free_result( Connection handle: 1 )

[15:19:12] CMySQLHandler::FreeResult() - There is nothing to free (Reason: Connection is dead)


Re: Can't connect to mysql host - Raimis_R - 30.09.2011

pawn Код:
#define mysql_host             "s1.hostingtime.de"//the IP of the host, should be displayed when created a database
#define mysql_user             "db223"//database username
#define mysql_password         "secret :D"//database password
#define mysql_database         "db223"//database name
Bad settings.

Код:
[15:19:11] CMySQLHandler::Connect() - Can't connect to MySQL server on 's1.hostingtime.de' (10061) (Error ID: 2003)



AW: Can't connect to mysql host - Egon_Olsen - 25.07.2012

Use for the mysql_host: localhost

And check your Password in the Settings!

Best Regards

F. Richter

HostingTime.de