LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (http://www.linuxquestions.org/questions/linux-newbie-8/cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-592421/)

mathimca05 10-17-2007 12:50 AM

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
 
hi all
i m new to mysql.i m trying to connect mysql from c. i m not running as root.
i gave this commands.

1. gcc -c `mysql_config --cflags` sqlex.c
2. gcc -o myclient sqlex.o `mysql_config --libs`
above
it works fine.its creating myclient executable file.when i try 2 execute myclient,its giving this error

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'


i dont know what to do?


thanks in advance.

ZAMO 10-17-2007 01:59 AM

Hello,

The permissions for '/var/lib/mysql/mysql.sock' must be set as follows.
srwxrwxrwx 1 mysql mysql 0 Oct 17 00:55 /var/lib/mysql/mysql.sock

You need root permission to set this and another option is making a symbolic link to /tmp/mysql.sock

acid_kewpie 10-17-2007 02:04 AM

might be worth noting that you've not even confirmed mysql is running, or even exists.... the fact that you've compiled a client is, in itself, not useful.


All times are GMT -5. The time now is 11:23 PM.