Question

"Error establishing a database connection" - Wordpress Installation

I installed Wordpress on an Apache server, but when I go to the index.php file with my web browser, expecting to see the GUI for setting up WP, I get “Error establishing a database connection”. Can anyone point me in the right direction for straightening this out?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, @willjackson

If you’re installing WordPress manually you can check our tutorial on How To Install WordPress on Ubuntu 20.04 with a LAMP Stack

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-20-04-with-a-lamp-stack

You’ll need to create a database and database user in step one and then complete the installation through the Web Interface

Also, you can quickly deploy a WordPress droplet using our Marketplace app:

https://marketplace.digitalocean.com/wordpress

https://www.digitalocean.com/community/tutorials/how-to-use-the-wordpress-one-click-install-on-digitalocean-2

Regards, Alex

Hi @willjackson,

Have you configured the WordPress website’s Database? You’ll need to create an empty database, a database user and a password for that user. Once you do, when installing WordPress, you’ll need to put this information in the wizard. This should help with the problem.

If you let us what process you followed and when exactly you experienced the problem, we should be able to give you a more detailed response.