SA-MP Forums Archive
MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - 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: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket (/showthread.php?tid=528802)



MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Emre__ - 29.07.2014

Hi,

I'm using MySQL Plugin r39-2 by BlueG and whenever I start up the server I do come up with the error

Code:
[ERROR] CMySQLConnection::Connect - (error #2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
My MySQL Login Informations are correct. I'm using mysql_static.so because others wants libmysqlclient.so.18 and libmysqlclient.so.16 which I don't have so they gave me this advice to use mysql_static.so but this gives the error.

This socket file cannot be found. My server is not on personal machine. It is a gameserver from nitrado.net. So give me an advice to how to fix it.


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - sammp - 29.07.2014

Code!


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Emre__ - 29.07.2014

Which code do you want me to provide?


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - sammp - 29.07.2014

Connection code!


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Emre__ - 29.07.2014

Quote:
Originally Posted by sammp
View Post
Connection code!
pawn Code:
#define MYSQL_HOST      "localhost"
#define MYSQL_USER      "mysql_user_name"
#define MYSQL_PASS      "password"
#define MYSQL_DB        "db_name"

new dbHandle;

dbHandle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
It doesn't work either 127.0.0.1 or localhost


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - OldReece - 29.07.2014

Quote:

It doesn't work either 127.0.0.1 or localhost

Lol man you are establishing your username as "mysql_user_name" and its password as "password"

You should therefore connect by those values.


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Emre__ - 29.07.2014

Quote:
Originally Posted by OldReece
View Post
Lol man you are establishing your username as "mysql_user_name" and its password as "password"

You should therefore connect by those values.
No, these values are censored.


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - OldReece - 30.07.2014

You should be able to login using that username and password respectively.

That's why you defined them like that.


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Raefal - 30.07.2014

use symlink


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Raefal - 30.07.2014

ln -s directorynow/mysql.sock /var/run/mysqld/mysqld.sock


Re: MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket - Emre__ - 30.07.2014

Quote:
Originally Posted by Raefal
View Post
ln -s directorynow/mysql.sock /var/run/mysqld/mysqld.sock
It's a game host, I do NOT have the control over the machine so I can't create symlink.

edit: I used global ip (not localhost or 127.0.0.1) to connect the database and somehow it worked.