1. Home
  2. WordPress
  3. Troubleshooting
  4. Error establishing a database connection

Error establishing a database connection

In this article we will review what this error means and several ways you can troubleshoot it.

There are several reasons why you would see this error message:

  1. Your WordPress site is still being deployed and it’s not ready.
  2. You tried to access one of the slave nodes in your cluster that won’t load WordPress.
  3. The wp-config.php file has been updated or changed.

Your WordPress site is not ready

Once you deploy your WordPress instance, it does take some time to install it on the Flux network. If you try to early, you could get one of the following:

Or

You accessed one of the slave nodes on accident

Something that is very easy to do, is to try and access one of the nodes under your cluster is in the Dapps details page.

How Flux is setup, only one of them acts as the Master and the other nodes act as slaves. This would only allow one of the nodes to display the website correctly. This results in all other nodes showing:

Error establishing a database connection


The WP config has been updated or edited

If this happens, you would most likely understand what you are doing before this file is edited. The wp-config.php file is a very powerful file that lives in the root directory of your site and can control how your site loads, is configured, and contains the information that connects your site to the database.

One of the ways to edit this file is to install the WP File Manager plugin and edit wp-config.php


Ways you can troubleshoot error establishing a database connection

  • First, you can wait a bit longer for the deployment to finish preparing the instance. We typically recommend 1-2 hours to account for network traffic and time to propagate.
  • Test all of the node IP addresses to see which one will bring up the WordPress installation screen. Once you find it, that will be your master node that will be the primary machine hosting the site.
  • If you have done the two steps above and hours have passed, you can login to each node and do a soft redeployment. This will reset the WordPress installation files and can correct the incorrect config if it was changed.

  • Click on the FluxOS link to bring you to the node login screen

FluxOS Dashboard 2023-03-01 at 12.25.19 AM
  • Login with Zelcore to the node
  • Navigate to Apps > Local Apps > My Local Apps

  • Click on Manage
  • Click on Manage App

  • Click Control
  • Click Soft Redeploy App
  • “Are you sure?” Redeploy

You will see the log start to populate at the bottom of your screen

{"status":"Stopping Flux App Component operator…"}
{"status":"Flux App Component operator stopped"}
{"status":"Removing Flux App component operator container…"}
{"status":"Flux App component operatorcontainer removed"}
{"status":"Removing Flux App component operator image…"}
{"status":"Flux App component operator image operations done"}
{"status":"Denying Flux App component operator ports…"}
{"status":"Ports of component operator denied"}
{"status":"Flux App component operator of wordpress1676999060198 was successfuly removed"}
{"status":"Stopping Flux App Component mysql…"}
{"status":"Flux App Component mysql stopped"}
{"status":"Removing Flux App component mysql container…"}
{"status":"Flux App component mysqlcontainer removed"}

  • You can do this on all of your nodes
  • After about 5 minutes you can try loading your website again to see if you’re able to access it
Updated on March 8, 2023

Related Articles