Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 09-08-2009, 02:30 PM   #1
LQ Newbie
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

My website's hosting is throwing the following error when trying to connect via a subdomain using 'localhost' as the MySQL host:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
On other subdomains, we connect to MySQL using the full URL (e.g. but when I do that with this new domain I get the following error:

Lost connection to MySQL server at 'reading initial communication packet', system error: 111
I also tried using "" as the server, and that also resulted in an error 111.

Any ideas?
Old 09-09-2009, 03:27 AM   #2
LQ Newbie
Registered: Sep 2009
Location: Lausanne (Switzerland)
Distribution: Ubuntu
Posts: 12

Rep: Reputation: 3
The first error (2 -> No such file or directory ) comes from the fact that you have no mysql server running on localhost.

The second one (111 -> Connection refused) shows that either mysql port is blocked (firewall for instance) or that no mysql server is running on

Are you sure that the machine with mysql server is reachable from your new subdomain? If not, you have found your problem. Be also sure to use the correct url to join the mysql server.
2 members found this post helpful.
Old 09-10-2009, 05:15 AM   #3
LQ Newbie
Registered: Sep 2009
Posts: 2

Original Poster
Rep: Reputation: 0
For some reason when we deleted the schema and the associated MySQL account from their control panel and then re-created it, it worked fine. Doesn't really make any sense at all, but our hosting is often quite glitchy with stuff like this. I get the feeling that the config files weren't updated properly to allow access to the other domain.
Old 09-11-2009, 12:41 AM   #4
Registered: Mar 2008
Posts: 52

Rep: Reputation: 15
I think there are two mysql server...
and the lib file:** at the same path .
1. mysql server one: install by yum or rpm with os cdrom
2. mysql server two: install by source...
there are infilct between the
Old 09-09-2011, 11:12 AM   #5
LQ Newbie
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
check df

Hey guys, I had this problem and googled and googled. Then I ran df and saw that my disk was 100% full. So test that before you pull any more hair out.

This was the error I had that wouldn't let me get into MySQL. I couldn't find mysqld.sock because the system had no disk space to write it!

error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)'
1 members found this post helpful.
Old 09-06-2012, 01:29 AM   #6
LQ Newbie
Registered: Apr 2005
Distribution: Real geeks know Linux is Linux (Ubuntu, Suse, Mandriva, etc....)
Posts: 5

Rep: Reputation: 0
I was suspecting a full root file system was causign all my problems. When I saw rbucks comment, I knew my instincts must be right, so I went on a quest to remove files that were no longer needed. On my Ubuntu 10.04 system, this simple command cleared up over 400Meg of files that no longer were needed, and got the system up an running.

sudo apt-get autoremove

Last edited by SunnyDaze; 09-06-2012 at 01:30 AM. Reason: Corrected typos


error, mysql, subdomain

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 07:19 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Pode Slackware 12 11-26-2008 08:21 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
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mathimca05 Linux - Newbie 2 10-17-2007 02:04 AM
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

All times are GMT -5. The time now is 11:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration