Jump to content

Can't connect to local MySQL server through socket


stoneyd

Recommended Posts

are you sure that's not the same problem, it was intermittent.

 

I dont think its the same problem. tho the previous problem wasnt getting logged like that. which makes me think it may not be the same problem. if it is the same problem then we just gotten a clearer diagnosis of it

Link to comment
Share on other sites

I don't see what's different, you posted that error before.

 

so there is not difference between

 

PHP Warning:  mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (11) in 'some/file/on/my/web/server.php'

 

and

 

PHP Warning:  mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet', system error: 110

 

 

Link to comment
Share on other sites

if nothing is going in the logs that means you are not actually getting to the server, so yeah its not a max connection issue.

 

could you use a test script in the same folder as your site to try the connections

 

<?php

mysql_connect('localhost', 'user', 'pass');

mysql_connect('127.0.0.1', 'user', 'pass');

?>

 

and see if either work ?

 

 

See it is a intermittent issue. i've got the host set to the the actual ip. the localhost works but the 127.0.0.1 returns

'Warning: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /var/www/dev/test.php on line 4'

 

no no, back here...

Link to comment
Share on other sites

if nothing is going in the logs that means you are not actually getting to the server, so yeah its not a max connection issue.

 

could you use a test script in the same folder as your site to try the connections

 

<?php

mysql_connect('localhost', 'user', 'pass');

mysql_connect('127.0.0.1', 'user', 'pass');

?>

 

and see if either work ?

 

 

See it is a intermittent issue. i've got the host set to the the actual ip. the localhost works but the 127.0.0.1 returns

'Warning: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /var/www/dev/test.php on line 4'

 

no no, back here...

 

lol. right i forgot about that. see localhost works because it connects over the unix socket. but 127.0.0.1 wont work because the mysqld isnt listening to that ip its looking for the actual ip of the server. But under high-ish loads when it connects over the actual ip it the issue above.

Which doesnt really make since.

Link to comment
Share on other sites

Okay, it seems to be that your server is too overloaded to get a connection.

 

a load average of 5 is pretty high really although it does depend on your hardware.

 

You might need a server upgrade. Or a dodgy workaround that I had to use for a client once was to keep tying to connect until it worked.

Link to comment
Share on other sites

Okay, it seems to be that your server is too overloaded to get a connection.

 

a load average of 5 is pretty high really although it does depend on your hardware.

 

You might need a server upgrade. Or a dodgy workaround that I had to use for a client once was to keep tying to connect until it worked.

 

Seriously? Damn physical hardware limitations. I doubt upgrading RAM would help? but I don't think I'm gonna be able to upgrade the proc or anything else. During low times our load average: 0.32, 0.50, 1.41. I'll post tonight what our peak load averages are.

Link to comment
Share on other sites

I guess that means it has to be load related then. Which is a bit of a bad conclusion really  :(

 

You could try the keep trying until you get a connection approach I mentioned, although you would need to get the decrypted versions of those scripts.

Link to comment
Share on other sites

I guess that means it has to be load related then. Which is a bit of a bad conclusion really  :(

 

You could try the keep trying until you get a connection approach I mentioned, although you would need to get the decrypted versions of those scripts.

 

Well i guess in theory i could go with general log so it logs every query. but in a matter of 20-60 minutes or so i accrued close to 100k or 1mil lines in that file

Link to comment
Share on other sites

what ?

 

I meant more like

 

while (mysql_connect() === false);

 

But disabling the query log will defiantly help with server load.

 

i had the query log on just for a short time to see if i could see any problems in it.  but other sites running this same source haven't encountered problems like this.

I'm trying to figure out why this happens. Where do you think the bottleneck is happening? Also its gonna be impossible to get ahold of the source code to this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.