LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 10-17-2007, 01:50 AM   #1
mathimca05
Member
 
Registered: Oct 2007
Posts: 66

Rep: Reputation: 15
Thumbs up 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.
 
Old 10-17-2007, 02:59 AM   #2
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 579

Rep: Reputation: 30
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
 
Old 10-17-2007, 03:04 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mohadesz Linux - Server 3 03-15-2008 06:06 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 04:35 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) sunlinux Linux - Software 1 11-07-2006 01:08 AM


All times are GMT -5. The time now is 06:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration