LinuxQuestions.org

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

aish11 01-31-2012 03:02 AM

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

Satyaveer Arya 01-31-2012 03:20 AM

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

Satyaveer Arya 01-31-2012 03:25 AM

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.

aish11 01-31-2012 04:11 AM

Quote:

Originally Posted by Satyaveer Arya (Post 4589157)
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.

Satyaveer Arya 01-31-2012 04:21 AM

Quote:

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

aish11 01-31-2012 05:00 AM

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

aish11 01-31-2012 05:37 AM

Hi All,


Need help plz.....

acid_kewpie 01-31-2012 05:56 AM

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.

aish11 01-31-2012 06:12 AM

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

acid_kewpie 01-31-2012 06:20 AM

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.

aish11 01-31-2012 06:26 AM

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? :-(

acid_kewpie 01-31-2012 06:37 AM

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/

Satyaveer Arya 01-31-2012 09:10 PM

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

aish11 02-01-2012 01:37 AM

Quote:

Originally Posted by Satyaveer Arya (Post 4589911)
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

aish11 02-01-2012 01:52 AM

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


All times are GMT -5. The time now is 08:57 AM.