LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 12: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, 01:59 AM   #2
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

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, 02:04 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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



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 07:19 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mohadesz Linux - Server 3 03-15-2008 05:06 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) sunlinux Linux - Software 1 11-07-2006 12:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:45 AM.

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
Open Source Consulting | Domain Registration