SA-MP Forums Archive
MySQL Don't Connect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: MySQL Don't Connect (/showthread.php?tid=482203)



MySQL Don't Connect - GilianAbels - 19.12.2013

Hello People,

I'm creating a server, but it don't work.
The MySQL Connection fails.. Can anyone view my problem?


Код:
#define SQL_HOST "149.210.128.9"
#define SQL_USER "gepestword_strcm"
#define SQL_PASS "(SECRET :D)"
#define SQL_DB 	 "gepestword_strcm"

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

public OnGameModeInit()
{
	mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
 	if(mysql_ping() == -1) printf("MySQL connection attempt %d failed!");
  	else
	{
 		print("succes");
	}
	
    mysql_query("CREATE TABLE IF NOT EXISTS LSRPUsers(user VARCHAR(24), password VARCHAR(40), score INT(20), money INT(20), level INT(20), vip INT(20), kma INT(20), rank INT(20), kills INT(20), deaths INT(20), muted INT(20), jailed INT(20), frozen INT(20), mutedtimes INT(20), jailedtimes INT(20), frozentimes INT(20), banned INT(20), bannedby VARCHAR(24), logins INT(20), posx INT(20), posy INT(20), posz INT(20), posa INT(20), IP VARCHAR(15) )");
    mysql_debug(1);
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}
I allowed all connections in my webhost etc.
Website config works but SAMP can't connect to it.. Anyone know a solution??


SKYPE: Gilian.Abels
Greetz Gilian,


Re: MySQL Don't Connect - Brandon_More - 20.12.2013

MySQL_Debug.txt?


Re: MySQL Don't Connect - Emmet_ - 20.12.2013

Some connections disallow remote connections to the MySQL server, try this.

pawn Код:
#define SQL_HOST "127.0.0.1"



Re: MySQL Don't Connect - GilianAbels - 20.12.2013

No it's not 127.0.0.1, its an external webhost. But he don't connect, all things work...
My Mysql debug.txt? Here
Quote:

[16:55:45]

[16:55:45] ---------------------------

[16:55:45] MySQL Debugging activated (12/19/13)

[16:55:45] ---------------------------

[16:55:45]

[16:56:44]

[16:56:44] ---------------------------

[16:56:44] MySQL Debugging activated (12/19/13)

[16:56:44] ---------------------------

[16:56:44]

[03:25:39]

[03:25:39] ---------------------------

[03:25:39] MySQL Debugging activated (12/20/13)

[03:25:39] ---------------------------

[03:25:39]
Nothing wrong, isn't?


Re: MySQL Don't Connect - Emmet_ - 20.12.2013

Did you try it out first? Most of the time, when the IP of the SQL server matches with the server's IP, then you can simply use "127.0.0.1" to connect to it remotely.


Re: MySQL Don't Connect - GilianAbels - 20.12.2013

No we have one VPS and one webhost, its not the same IP ...


Re: MySQL Don't Connect - doreto - 20.12.2013

Is database from website ?


Re: MySQL Don't Connect - Khanz - 20.12.2013

On the webhost I assume you're running cPanel so go there and go to allow remote mysql, then enter your VPS ip.

Even better just run the Mysql database on your VPS.


Re: MySQL Don't Connect - GilianAbels - 20.12.2013

But i wan't to connect the server with my site, register via website? Than automaticly registered in server... And i use DirectAdmin, i filled in % (allowed all connections).. But nothing work..


Re: MySQL Don't Connect - DJ_Shocker - 20.12.2013

Quote:

I allowed all connections in my webhost etc.
Website config works but SAMP can't connect to it.. Anyone know a solution??


SKYPE: Gilian.Abels
Greetz Gilian,

Some WEBhosts won't allow remote connections for security reasons. I tried to host a database with HostGator for example, it wouldn't allow the connections. I finally called them, and they stated that it doesn't allow outside connections.

So if you're hosting a database through a webhosting company, ask them if they allow remote connections to the database.