Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420
Rep:
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 03:22 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
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.
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 05:58 AM.
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.
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 06:21 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?
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.
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.