Question
How do I cure "error establishing a database connection" after enabling https
My wordpress site is down after what probably comes down to me doing things in the wrong order. What I’ve done is the following:
- Setting up a droplet with a one-click wordpress site, but since I was planning to move an existing domain name to this new site only after building it, I didn’t configure the domain name or ssl certificate at this point.
- Built the wordpress site in the browser via the ip-adress.
- Pointed the domain to the new ip adress. (Created two A records for @ and www).
- Following this tutorial for setting up ssl certificate https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04.
- The tutorial said I should have a virtual host set up before going any further, and this is where things started go wrong, because I then followed the section about setting up virtual hosts in this other tutorial, https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04, without realizing this would create a mess.
- Backtracked and managed to get the document root pointed to the right directory again etc.
- Rebooted droplet to set up hostname and https via the built in scripts, but after doing this, the wordpress site can no longer establish a database connection. My hypothesis is that something is pointing in the wrong direction, e.g. some wordpress config not dealing properly with the hostname. I’ve tried debugging through this tutorial: https://www.digitalocean.com/community/tutorials/how-to-debug-the-wordpress-error-establishing-database-connection , but I can’t get the repair script to run (same error), and something tells me the problem is not corrupted tables but something more fundamental.
Can anyone make sense of this mess?
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.
×