Report this

What is the reason for this report?

Error establishing a database connection (!)

Posted on February 9, 2015

I was extremely restful with this tutorial of Wordpress installing. Until I enter the website and frustratingly found out this statement: **

Error establishing a database connection

**

I tried several solutions but nothing worked out!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Assuming the database is on the same server…

  1. Check that your database is actually running… ( sudo /etc/init.d/mysql start )

  2. Check that you have the correct info in the config.php file in your /wordpress/ directory… Ie: username = yourDBusername ( possibly “root”), password = yourDB password and host = localhost

Verify your DB my typing. mysql -u root -pYOURPASSWORD

Then type " Show databases;" ( Is your database listed? ) Type “exit” to quit.

/etc/init.d/mysql start worked for me, but is there any reason mysql would suddenly stop? Is there a log to check for this or something?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.