Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Couldn't connect to MySQL database


3 Posts   2829 Views

Dave L

18 February 2010 at 9:57am Community Member, 56 Posts

Error: Couldn't connect to MySQL database
At line 401 in /[edit]/sapphire/core/model/MySQLDatabase.php

Couldn't connect to MySQL database
Line 401 of MySQLDatabase.php
MySQLDatabase->databaseError(Couldn't connect to MySQL database)
Line 39 of MySQLDatabase.php
Line 79 of DB.php
Line 112 of main.php

Is anyone else receiving production errors along these lines? It seems sporadic, but I get emailed 2-3 times a month from different SS installs on different hosts. Not major, but then again some user somewhere is getting 500 response when accessing my sites. I'm wondering if it's a general error related to hosting provider networks, or something to do with SS response times if the site has been idle for a while. Any thoughts?


18 February 2010 at 10:35am (Last edited: 18 February 2010 10:36am), Community Member, 323 Posts

Hi Dave!

I was thinking of starting the same thread myself. I’m getting this error several times a day. I doubt it’s SS-related, since nobody seems to complaint. The servers where I’m hosting my sites seems not too reliable, by the way I’m in the process of migrating from them…


EDIT: The error is sometimes: Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111

Dave L

18 February 2010 at 10:47am Community Member, 56 Posts

Hi Juan,

Yea, could be a side effect of hosting providers usually pushing shared hosting to the limit. In any case, I got 2 errors in one minute from the same site at 9am today and another 3 in one minute at 10am. Hopefully it's not a trend.