Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
Hi All, When I try to connect to web sites residing on my laptop (both http://localhost/website and http://localhost/~user/website) I get the following message: "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)". The socket in question exists in /var/lib/mysql, it is owned by the mysql.mysql user and has the necessary permissions (775). Also, the mysql folder and the database folders within it are owned by mysql.mysql and have the necessary permissions (775). Also, when connecting to http://localhost/phpMyAdmin/ I got the following error message from MySQL: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured). However, after changing the server name in config.inc.php from localhost to 127.0.0.1 I can connect to phpMyAdmin successfully. Has anyone any ideas on what I am doing wrong? I have googled myself silly to no avail and would appreciate some assistance. Cheers, Alan. Alan Purchase Tregenna Business Services 113 Victory Road Laingholm Auckland 1007 New Zealand ||
On 5/11/06, Alan Purchase
Hi All,
When I try to connect to web sites residing on my laptop (both http://localhost/website and http://localhost/~user/website) I get the following message: "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)". The socket in question exists in /var/lib/mysql, it is owned by the mysql.mysql user and has the necessary permissions (775). Also, the mysql folder and the database folders within it are owned by mysql.mysql and have the necessary permissions (775).
Also, when connecting to http://localhost/phpMyAdmin/ I got the following error message from MySQL: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured). However, after changing the server name in config.inc.php from localhost to 127.0.0.1 I can connect to phpMyAdmin successfully.
Has anyone any ideas on what I am doing wrong? I have googled myself silly to no avail and would appreciate some assistance.
Cheers, Alan.
Alan Purchase Tregenna Business Services 113 Victory Road Laingholm Auckland 1007 New Zealand ||
If you do not specify server name when connecting to mysql server, or if this is localhost, the clients default to connect trough socket. If you specify servername (different than localhost), or ip address, the connection is made over tcp/ip port 3306. Thats why you succeed with 127.0.0.1. Now - your problem: to connect trough socket - the directory in which the socket is created, and the socket file have to read- and writable by the user, running the client. In your case this is most probably www. You can do this either by chmod 777, or by adding such a users in mysql group, as the socket file is created with 775 by default. Also, make sure that the clients "know" the directory of the socket file - i.e. for phpMyAdmin, check in php.ini. If you are using the commandline client (mysql), use the -s option to specify the socket. Cheers -- -- Svetoslav Milenov (Sunny) Windows is a 32-bit extension to a 16-bit graphical shell for an 8-bit operating system originally coded for a 4-bit microprocessor by a 2-bit company that can't stand 1 bit of competition.
Sunny wrote:
On 5/11/06, Alan Purchase
wrote: Hi All,
When I try to connect to web sites residing on my laptop (both http://localhost/website and http://localhost/~user/website) I get the following message: "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)". The socket in question exists in /var/lib/mysql, it is owned by the mysql.mysql user and has the necessary permissions (775). Also, the mysql folder and the database folders within it are owned by mysql.mysql and have the necessary permissions (775).
Also, when connecting to http://localhost/phpMyAdmin/ I got the following error message from MySQL: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured). However, after changing the server name in config.inc.php from localhost to 127.0.0.1 I can connect to phpMyAdmin successfully.
Has anyone any ideas on what I am doing wrong? I have googled myself silly to no avail and would appreciate some assistance.
Cheers, Alan.
Alan Purchase Tregenna Business Services 113 Victory Road Laingholm Auckland 1007 New Zealand ||
If you do not specify server name when connecting to mysql server, or if this is localhost, the clients default to connect trough socket. If you specify servername (different than localhost), or ip address, the connection is made over tcp/ip port 3306. Thats why you succeed with 127.0.0.1.
Now - your problem: to connect trough socket - the directory in which the socket is created, and the socket file have to read- and writable by the user, running the client. In your case this is most probably www. You can do this either by chmod 777, or by adding such a users in mysql group, as the socket file is created with 775 by default. The directory is writeable but just to make sure I added www to the mysql group. It made no difference, I still get the error.
Also, make sure that the clients "know" the directory of the socket file - i.e. for phpMyAdmin, check in php.ini. If you are using the commandline client (mysql), use the -s option to specify the socket.
Surely the client knows the location of the socket file as the error states that the client cannot connect to the socket file.
Cheers
--- Alan Purchase
Hi All,
When I try to connect to web sites residing on my laptop (both http://localhost/website and http://localhost/~user/website) I get the following message: "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)".
Do you have a php/perl/python etc. script that connects to MySQL??? What is it what is your code??
The socket in question exists in /var/lib/mysql, it is owned by the mysql.mysql user and has the necessary permissions (775). Also, the mysql folder and the database folders within it are owned by mysql.mysql and have the necessary permissions (775).
is mysql running?? Have you started it through YaST??
Also, when connecting to http://localhost/phpMyAdmin/ I got the following error message from MySQL: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured). However, after changing the server name in config.inc.php from localhost to 127.0.0.1 I can connect to phpMyAdmin successfully.
Has anyone any ideas on what I am doing wrong? I have googled myself silly to no avail and would appreciate some assistance.
check your host name is it local host when you run the script in run levels did you get a warning that you will not be able to use localhost?? What versions are you using?? Regards, George
Cheers, Alan.
Alan Purchase Tregenna Business Services 113 Victory Road Laingholm Auckland 1007 New Zealand ||
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
George Stoianov wrote:
--- Alan Purchase
wrote: Hi All,
When I try to connect to web sites residing on my laptop (both http://localhost/website and http://localhost/~user/website) I get the following message: "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)".
Do you have a php/perl/python etc. script that connects to MySQL??? What is it what is your code??
The web sites I build typically use the Drupal CMS and are written in PHP.
The socket in question exists in /var/lib/mysql, it is owned by the mysql.mysql user and has the necessary permissions (775). Also, the mysql folder and the database folders within it are owned by mysql.mysql and have the necessary permissions (775).
is mysql running?? Have you started it through YaST??
Yes it is running. Runlevels are the defaults, 2, 3 and 5.
Also, when connecting to http://localhost/phpMyAdmin/ I got the following error message from MySQL: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured). However, after changing the server name in config.inc.php from localhost to 127.0.0.1 I can connect to phpMyAdmin successfully.
Has anyone any ideas on what I am doing wrong? I have googled myself silly to no avail and would appreciate some assistance.
check your host name is it local host when you run the script in run levels did you get a warning that you will not be able to use localhost?? What versions are you using??
No warnings. Apache 2.0.54, MySQL 4.1.13, PHP 4.4.0. I don't see why this is proving so difficult. It worked 'out of the box' on Mandrake 9, a wee while ago mind you.
Regards, George
Cheers, Alan.
Alan Purchase Tregenna Business Services 113 Victory Road Laingholm Auckland 1007 New Zealand ||
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
participants (3)
-
Alan Purchase
-
George Stoianov
-
Sunny