-   Linux - Server (
-   -   Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (

Burningmace 09-08-2009 02:30 PM

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?

alexroux 09-09-2009 03:27 AM

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.

Burningmace 09-10-2009 05:15 AM

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.

xiutuo 09-11-2009 12:41 AM

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

rbucks 09-09-2011 11:12 AM

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)'

SunnyDaze 09-06-2012 01:29 AM

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

All times are GMT -5. The time now is 03:47 PM.