MySQL Databse. - 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 Databse. (
/showthread.php?tid=537722)
MySQL Databse. -
TheSnaKe - 17.09.2014
Hello there, am getting these errors when am starting my server in the host.
I have created MySQL database but i don't know why am getting these errors.
Код:
[13:09:01] [MySQL] Error (0): Function: mysql_query called when not connected to any database. Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
[13:09:01] [MySQL] Error (0): Failed to connect. Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
My code
Код:
#define db "my database username"
#define host "localhost"
#define user "my database username"
#define pass "my database password"
I think my code is fine, what's wrong then?
Re: MySQL Databse. -
FlawPaw - 17.09.2014
Don't tell me you didn't actually change "my database username", "my database password" and all that shit..?
Re: MySQL Databse. - Guest4390857394857 - 17.09.2014
DId you use this function (mysql_connect) under ongamemodeinit or onfilterscriptinit
Otherwise your server won't get connected to the MYSQL server or then the queries won't be performed in database if not connected.
Re: MySQL Databse. -
TheSnaKe - 17.09.2014
Quote:
Originally Posted by FlawPaw
Don't tell me you didn't actually change "my database username", "my database password" and all that shit..?
|
Dude, do i have to say my database info in here? Please.
Re: MySQL Databse. -
TheSnaKe - 17.09.2014
Quote:
Originally Posted by ShivRp
DId you use this function (mysql_connect) under ongamemodeinit or onfilterscriptinit
Otherwise your server won't get connected to the MYSQL server or then the queries won't be performed in database if not connected.
|
Yep, but it doesn't works.
Re: MySQL Databse. -
Sawalha - 17.09.2014
how's your mysql_connect code looks?
which program you use to connect to mysql database?
Re: MySQL Databse. -
TheSnaKe - 17.09.2014
Quote:
Originally Posted by Sawalha
how's your mysql_connect code looks?
which program you use to connect to mysql database?
|
My mysql_connect code
Код:
mysql_connect( host, user, pass, db, mysql, 1 );
#endif
Am using phpmyadmin to connect to my mysql database.
Re: MySQL Databse. -
TonyNames - 17.09.2014
Quote:
Originally Posted by TheSnaKe
Dude, do i have to say my database info in here? Please.
|
Well, it's on localhost. Nothing should happen..
Re: MySQL Databse. -
Vince - 17.09.2014
If you use iptables, make sure to add an exception for the lo interface to the top of the list.
Re: MySQL Databse. -
TheSnaKe - 17.09.2014
Still not working