Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error establishing a database connection

Wany
New Member

I got this one on my subdomain website.

I set up this one on GCP and the main domain is working okay but subdomain is not working well.

hope you figure it out what I have to do

Thanks.

3 1 496
1 REPLY 1

Here are a few key areas to investigate, based on best practices for troubleshooting this type of issue:

  1. Database Connectivity:

    • Double-check that yourCloud SQL instance is up and running.
    • Make sure your firewall rules allow the web server hosting your subdomain to access the database. If using private IPs, verify the network configuration.
    • Confirm that your database credentials (hostname, username, password, database name) are correctly entered in your subdomain website's configuration files.
  2. Subdomain Configuration:

    • Ensure that the DNS A record for your subdomain points to the right IP address of your web server.
    • Review your web server configuration (Apache or Nginx) to see if the virtual host setup for the subdomain is accurate.
  3. WordPress Considerations (if applicable):

    • Did you migrate your WordPress site to the subdomain? If so, double-check if the table prefix in the database matches the one in your wp-config.php file.
    • Try deactivating any recently added or updated plugins/themes in case they are causing conflicts.
  4. Debugging Tools:

    • Take a look at your web server's error logs and the Cloud Logging logs for your Cloud SQL instance. They might contain valuable clues.
    • If your site uses PHP, enable error reporting to get more detailed information.