LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-31-2012, 04:02 AM   #1
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

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


Hi All,

I'm getting the following error message:

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


can anyone provide me this file??


Thanks
 
Old 01-31-2012, 04:20 AM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
If your file my.cnf (usually in the etc folder) is correctly configured with

socket=/var/lib/mysql/mysql.sock
you can check if mysql is running with the following command:

# mysqladmin -u root -p status
try changing your permission to mysql folder. If you are working locally, you can try:

# sudo chmod -R 777 /var/lib/mysql/


And there is also a quick workaround, try using the local ip address (127.0.0.1) instead of 'localhost' in mysql_connect(). This "forces" php to connect through TCP/IP instead of a unix socket.

And also check the logs, /var/log/mysql

Last edited by Satyaveer Arya; 01-31-2012 at 04:22 AM.
 
Old 01-31-2012, 04:25 AM   #3
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
You please also check this solved issue :

http://wordpressapi.com/2011/02/03/s...lmysql-sock-2/
http://corpocrat.com/2008/05/16/fix-...ysqlmysqlsock/
this might solve your problem.

Last edited by Satyaveer Arya; 01-31-2012 at 04:26 AM.
 
Old 01-31-2012, 05:11 AM   #4
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Satyaveer Arya View Post
If your file my.cnf (usually in the etc folder) is correctly configured with

socket=/var/lib/mysql/mysql.sock
you can check if mysql is running with the following command:

# mysqladmin -u root -p status
try changing your permission to mysql folder. If you are working locally, you can try:

# sudo chmod -R 777 /var/lib/mysql/


And there is also a quick workaround, try using the local ip address (127.0.0.1) instead of 'localhost' in mysql_connect(). This "forces" php to connect through TCP/IP instead of a unix socket.

And also check the logs, /var/log/mysql

Hi Arya,

mysql folder is not availbale in "/var/lib"

and i am not getting the below option

Code:
And there is also a quick workaround, try using the local ip address (127.0.0.1) instead of 'localhost' in mysql_connect(). This "forces" php to connect through TCP/IP instead of a unix socket.
 
Old 01-31-2012, 05:21 AM   #5
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Quote:
mysql folder is not availbale in "/var/lib"
Then, have you installed MySql properly? If not, try installing MySql again..

Last edited by Satyaveer Arya; 01-31-2012 at 05:23 AM.
 
Old 01-31-2012, 06:00 AM   #6
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Tried the below command

Code:
[root@TEST2 installables]# rpm -ivh MySQL-server-5.5.11-1.rhel5.x86_64.rpm
error: Failed dependencies:
        MySQL conflicts with mysql-5.1.52-1.el6_0.1.x86_64

how to solve above error
 
Old 01-31-2012, 06:37 AM   #7
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Hi All,


Need help plz.....
 
Old 01-31-2012, 06:56 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
The error is usually because the mysql server is not even running. is it? Why are you trying to "fix" this by installing an RPM that is for a different version of RHEL than the one you are using?? You have provided no useful information about your system whatsoever, so I don't really see how we are supposed to be able to help you. Given that you say you have no /var/lib/mysql directory, my money is on the fact that you've never even started it once, let alone configured it ready for use.

And do NOT bump your threads. You have NO right to get a response, and it's only been 90 minutes since the last reply.

Last edited by acid_kewpie; 01-31-2012 at 06:58 AM.
 
Old 01-31-2012, 07:12 AM   #9
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Hi acid kewpie,

First time i am installing this mysql , i am new to this.

I am having two files ..
1)MySQL-client-5.5.11-1.rhel5.x86_64.rpm
2)MySQL-server-5.5.11-1.rhel5.x86_64.rpm


and the commands i have run yet is
Code:
  
 rpm -ivh MySQL-client-5.5.11-1.rhel5.x86_64.rpm 
 and

2nd command is

[root@TEST2 installables]# rpm -ivh MySQL-server-5.5.11-1.rhel5.x86_64.rpm
error: Failed dependencies:
        MySQL conflicts with mysql-5.1.52-1.el6_0.1.x86_64
i dont know the steps can you or anybody help me by providing the steps from starting.

my problm is i need to install this mysql today only.


if need i can again reinstall this .


Thanks in advance
 
Old 01-31-2012, 07:20 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
You do realise that once it's installed, which you're clearly struggling with, you still need to actually configure it as well??


What version of RHEL are you using? It looks like it's 6, as mysql-5.1.52-1.el6_0.1.x86_64 is apparently already installed, so stop trying to install software for version 5 for a start.

IF you need to install software on RHEL, run "yum install mysql-server", do not download random packages from the net. If yum doesn't work due to having no RHN subscription, then you really have no business running RHEL in the first place and you should look to use a free alternative like CentOS.

Last edited by acid_kewpie; 01-31-2012 at 07:21 AM.
 
Old 01-31-2012, 07:26 AM   #11
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Angry

1) i dont know how to chek the version of RHEL?
2)when i have enter the command Mysql i am getting below output

Code:
 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
3)i thinks the mysql is not installed yet

4)Not getting what to do next? :-(
 
Old 01-31-2012, 07:37 AM   #12
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Without wishing to sound rude, is there just not someone else there who can do this instead? If you're not even aware of the version of operating system you're using, it really feels that this is all going to be somewhat futile. You really can't "think" something is installed, you need to *KNOW*.

Does "yum install mysql-server" or "yum install mysql" work? - meaning, does it say that mysql is installed?

You should see something like this... http://www.ehowstuff.com/how-to-inst...on-centos-6-2/

In general, this guide looks like it might be useful http://www.if-not-true-then-false.co...-red-hat-rhel/

Last edited by acid_kewpie; 01-31-2012 at 07:40 AM.
 
Old 01-31-2012, 10:10 PM   #13
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Quote:
i dont know how to chek the version of RHEL?
Quote:
# uname -a
this will tell you everything.

Check whether your mysqld service is running or not?

Quote:
# /etc/init.d/mysqld status
If it is not then start the mysqld service:

Quote:
# /etc/init.d/mysqld start
 
1 members found this post helpful.
Old 02-01-2012, 02:37 AM   #14
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Satyaveer Arya View Post
this will tell you everything.

Check whether your mysqld service is running or not?



If it is not then start the mysqld service:
inside /etc/init.d/ ---->there is no mysqld available.

i am using the version-
Code:
 Linux TEST2 2.6.32-131.0.15.el6.x86_64 #1 SMP Sat May 21 10:27:57 CDT 2011 x86_64 x86_64 x86_64 GNU/Linux

can anyone help me from staring


as in the last post i have mentined what i have done yet

Quote:
Hi acid kewpie,

First time i am installing this mysql , i am new to this.

I am having two files ..
1)MySQL-client-5.5.11-1.rhel5.x86_64.rpm
2)MySQL-server-5.5.11-1.rhel5.x86_64.rpm


and the commands i have run yet is

Code:

rpm -ivh MySQL-client-5.5.11-1.rhel5.x86_64.rpm
and

2nd command is

[root@TEST2 installables]# rpm -ivh MySQL-server-5.5.11-1.rhel5.x86_64.rpm
error: Failed dependencies:
MySQL conflicts with mysql-5.1.52-1.el6_0.1.x86_64i dont know the steps can you or anybody help me by providing the steps from starting.

my problm is i need to install this mysql today only.


if need i can again reinstall this .


Thanks in advance
 
Old 02-01-2012, 02:52 AM   #15
aish11
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
The error is usually because the mysql server is not even running. is it? Why are you trying to "fix" this by installing an RPM that is for a different version of RHEL than the one you are using?? You have provided no useful information about your system whatsoever, so I don't really see how we are supposed to be able to help you. Given that you say you have no /var/lib/mysql directory, my money is on the fact that you've never even started it once, let alone configured it ready for use.

if on my server "mysql-5.1.52-1.el6_0.1.x86_64i" is already installed ...the how can i use the same

when i run the command -" mysql" on server

its giving me
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
how to solve above error
 
  


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
HTTPD: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' markseger Fedora - Installation 2 02-10-2011 12:53 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
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mathimca05 Linux - Newbie 2 10-17-2007 03:04 AM
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 10:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration