stoneyd Posted March 30, 2011 Author Share Posted March 30, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1194703 Share on other sites More sharing options...
betterphp Posted March 30, 2011 Share Posted March 30, 2011 I don't see what's different, you posted that error before. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1194707 Share on other sites More sharing options...
stoneyd Posted March 30, 2011 Author Share Posted March 30, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1194708 Share on other sites More sharing options...
betterphp Posted March 30, 2011 Share Posted March 30, 2011 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... Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1194711 Share on other sites More sharing options...
stoneyd Posted March 31, 2011 Author Share Posted March 31, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1194725 Share on other sites More sharing options...
betterphp Posted March 31, 2011 Share Posted March 31, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1194973 Share on other sites More sharing options...
stoneyd Posted March 31, 2011 Author Share Posted March 31, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195044 Share on other sites More sharing options...
betterphp Posted March 31, 2011 Share Posted March 31, 2011 0.3 is obviously fine, at these times do you still have the problem ? Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195064 Share on other sites More sharing options...
stoneyd Posted March 31, 2011 Author Share Posted March 31, 2011 0.3 is obviously fine, at these times do you still have the problem ? Nope. I don't. It kinda sucks. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195078 Share on other sites More sharing options...
betterphp Posted March 31, 2011 Share Posted March 31, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195089 Share on other sites More sharing options...
stoneyd Posted March 31, 2011 Author Share Posted March 31, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195091 Share on other sites More sharing options...
betterphp Posted March 31, 2011 Share Posted March 31, 2011 what ? I meant more like while (mysql_connect() === false); But disabling the query log will defiantly help with server load. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195096 Share on other sites More sharing options...
stoneyd Posted March 31, 2011 Author Share Posted March 31, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195111 Share on other sites More sharing options...
betterphp Posted April 1, 2011 Share Posted April 1, 2011 Well if you have a high load average then I guess you are just hitting the maximum bandwidth maybe, or its might be the RAM / CPU not being able to process as fast as mysql wants. Very hard to say really. Quote Link to comment https://forums.phpfreaks.com/topic/232204-cant-connect-to-local-mysql-server-through-socket/page/2/#findComment-1195721 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.