SA-MP Forums Archive
I can't connect to mysql database... - 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: I can't connect to mysql database... (/showthread.php?tid=656487)



I can't connect to mysql database... - Hreesang - 17.07.2018

I've just learnt portforwarding and I'm success, my server is online now (non mysql).
So I tried somebody's gamemode Base Roleplay Script (LS-RP replica) and using mysql, but when I tried to connect my server to the database, it's failed but the server still online, so if tried to In Game, it'd be only stuck in the Login System (because the server can't connect to the database), I'm using xampp to controlling the database, I don't know why I can't connect into the database.

But, when I change the HOST to 'localhost', the server can connect to the database and all is okay FOR ME, then I tell my friend to connect to my server, but he was same with me before, only stuck in the Login System.

With this code, my server can connect to the database, I can login and play into the server, but my friend can't connect and stuck in the Login System.
Код:
#define SQL_HOSTNAME "localhost"
#define SQL_USERNAME "root"
#define SQL_DATABASE "sampdatabase"
#define SQL_PASSWORD "root"
With this code, the hostname is my whatsmyipadress' ip, the ip of my server when it's online but the server can't connect to the database, it's only shown online.
Код:
#define SQL_HOSTNAME "18x.xxx.xx.xxx"
#define SQL_USERNAME "root"
#define SQL_DATABASE "sampdatabase"
#define SQL_PASSWORD "root"

PS: If you don't get me, tell me which part you didn't get it, for me it's hard to explain anything in English.


Re: I can't connect to mysql database... - denNorske - 17.07.2018

Make sure you are allowing external connections to the database.
Some examples: https://stackoverflow.com/questions/...ction-to-mysql

If you're using phpMyAdmin you can check if you are able to adjust the setting under Users --> yourusername --> host


Re: I can't connect to mysql database... - Hreesang - 17.07.2018

I already told my friend to do on his own computer and connection, and he can (he can connect into it and he also can login):
PHP код:
180.248.10.205/phpmyadmin 
But the question is why my samp server cannot connect into it?