Why this happens

WordPress stores every post, page, setting, and user account in a MySQL database, and connects to it using credentials stored in wp-config.php. If those credentials are wrong, the database server is temporarily overloaded or down, or the database itself has become corrupted, WordPress can no longer reach your content at all.

Step-by-step fix

  1. Open wp-config.php and check the values for DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST.
  2. Go to the MySQL Databases section in cPanel and confirm these details are correct.
  3. If everything looks right, ask your hosting provider whether the database server is running (this is sometimes on their end).
  4. If you recently changed the database password, remember to update it in wp-config.php too.

How to prevent it happening again