Page 1 of 1

problem with mysql socket

PostPosted: 19. October 2006 15:18
by Touny
hello

I have problem with my mySQL databaze (installed via LAMPP) ... some other program (whitch i allready uninstaled) maked some problems on it.

When i am trying to connect do database (PHP) - mySQL return:

,,Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)"

Can anyone help me ?

Thanks a lot.

PostPosted: 11. December 2006 11:47
by Andy_1982
i try to help you to solve your problem ... i hope it isn't too late!!
If you want to connect to a mysql database, it looks like this:(it is written in c!)

mysql_real_connect(*database, user, password, database name, port, socket, flags)

this is the way you connect ...

user, password datebase name and port is clear i hope ... and now you have just to put "/opt/lampp/var/mysql/mysql.sock" for the socket ... and then it works ...

in a c-code it can looks like this:

mysql_real_connect(mysql, "localhost", "user", "password", "database_new", 3306, "/opt/lampp/var/mysql/mysql.sock", 0)

so i hope this is right and i was able to help you! bye