what are the source of errors: error establishing database connection

February 9, 2015 741 views

Hi all,

I moved to DO from a shared host.
I asked a freelance admin to do it for me as im not a techie.

Since my website is on DO then im facing many times website down with the common error as stated in topic title. Thing i didnt experience before with my shared host though shared host was very humble. There was a time i had an error with my IP used as torrent ip so i changed to a new ip.
In the shared host i also changed, installed many plugins but didnt have these errors.

My droplet is 4Gb RAM Centos 6.5 64bit. Traffic is just increasing 20-25% with shared host traffic.

So what could be the reason?

  • Some plugins?
  • DO's infrastructure problem?
  • freelance admin didn't configure the host well?
  • some neutral issues? -...

Please help!
Thank you,

2 Answers

The error means that wordpress(php) cannot connect to your database ( where your wordpress content is stored)

The database is likely mysql..

Login to your server and type:

su -
(Enter password)
service mysqld status

Does it say Running?

If not, try:
service mysqld start

Reload your page, Is it working now?

If mysql had stopped, it could be down to a bad plugin crashing mysql ( or you may of ran out of memory? )

Might be worth adding a small 1G swap file to your centos server.. By default DO images dont have one and MYSQL willl die if it cant swap / runs out of memory.

obviously you have bigger issues if you run out of memory.. but its a start..

*So what could be the reason? *

  • Some plugins? ( Possibly )
  • DO's infrastructure problem? ( Very unlikely )
  • freelance admin didn't configure the host well? ( Possibly )
  • some neutral issues?.. ( ? )

thank you,
it already has 1gb swap space.
yes it was working whenever i can restart mysqld or restart the droplet.

Have another answer? Share your knowledge.