• Hey, so here’s my situation. My primary issue is that each time I try to recreate and deploy the WordPress docker stack, everything looks like it’s working and the wordpress_wordpress and wordpress_db begin running, but when trying the visit the site by putting the address of my home server:port into the URL bar, I’m now always given ‘Database Error’ and a screen that just says ‘Error establishing a database connection’. The issue is that I thought it’d be a good idea to manually go in and do #rm /path/wordpress/* and restart, and then rerun the docker stack, but it was very much not.

    Context: My end goal with this was to self host my own WordPress website in a docker container on my home server, and have been following tutorials to do just that. There were a bunch of other steps I took that contributed to getting me into this mess with wordpress like setting up the domain I purchased in cloud flare and then in Nginx proxy manager that I was also hosting, but they shouldn’t have affected this other than leading me to make these mistakes when I didn’t get the expected result after trying to visit my domain.

    I’d already gotten wordpress running correctly in docker, visited the webGui and set up my account, and saw that it had created many files in my wordpress folder on my server. The first issue I ran into was that, in confusion as to what I was doing wrong after setting up my domain in Nginx and it still not giving me the expected congratulations screen when visiting my domain and instead loaded infinitely, I was throwing everything at the wall to see if anything would stick. I decided to go into the settings of wordpress and change the Site URL and other site setting to https://[My domain name], changing it from my home servers address and port because I thought it would make sense to make something good happen. This caused the site to become completely inaccessible to me, making me panic a bit, and searched some of the files in WordPress for any ctrl+f match to my domain name, but couldn’t find anything. So instead of searching for and following steps to resolve this apparently and understandably common issue, I thought I could, and that it’d be a good idea, for me to just delete the files and start over again, right? Well, thats what I did by SSH’ing into my home server, navigating to the path that the wordpress files were in, and doing #rm path/wordpress/*. Sure enough, it deleted everything inside of the wordpress directory, so I then deleted the stack in portainer, deleted the images, and re-ran the stack. Portainer showed both wordpress_wordpress and wordpress_db going back up and running again, and the logs in each seemed fine, but WordPress became completely inaccessible to me then. I’ve sinced tried what I think has been everything in editing the stack. I changed the volume that the wordpress files are stored, tried changing the db volume from /var/lib/mysql to mysql1, changed db names, usernames, passwords, everything, and nothing seems to be working. I’ve searched the 2 volumes for db and wordpress for hidden files anywhere with ls -a and can’t find anything. No matter what I try to change and reset, every time I try to run the stack again and visit the WebGUI address and port, I’m just met with an ‘Error establishing a database connection’ screen. I’m not sure if the full story as to how I got to this point was entirely necessary but this is the first time I’ve run into issues with this kind of stuff so bad that I couldn’t solve it for multiple days, have no idea part of what I’m doing and need to do, and really need some help, thanks.

    TLDR: I get ‘Error establishing a database connection after deleting everything in my wordpress volume with #rm path/wordpress/* and trying to restart, and don’t know how to fix it :/

    • This topic was modified 2 years, 11 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    : I get ‘Error establishing a database connection after deleting everything in my wordpress volume with #rm path/wordpress/* and trying to restart, and don’t know how to fix it :/

    Docker aside, (1) is the MySQL server running, (2) is there a database created for WP to use, (3) do the user/password for that database match what’s in wp-config.php?

    Thread Starter skyblaze

    (@skyblaze)

    Hey Steve, thanks for the response,
    1. I believe the SQL server is running, at the end of the logs of wordpress_db is Version: '5.7.36' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
    2. I’m not sure where to look for a yes or no on that, but if it has to do with the files that were originally generated in the wordpress folder, nothing is being created inside that folder anymore, which is the one I assigned as the volume for wordpress, and when I first ran it without issue it did generate files there.
    3. I saw and looked into wp-config.php when it was one of the files generated in the wordpress folder, but those were the ones I deleted and cannot find a new location where they would be, leading me to believe they’re not being created at all or anywhere where I have any idea to find them. In the stack, the user/password do match each other.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot reinstall WordPress in docker after manually deleting all directories’ is closed to new replies.