Back

Database Connection Troubleshooting

Database Connection Troubleshooting

A "Cannot connect to database" or "Error establishing a database connection" message means your application cannot communicate with its database server. This guide helps you diagnose and fix the most common causes on GoSiteMe hosting.

Common Causes

  1. Incorrect credentials: Wrong database name, username, or password in your configuration file.
  2. Database server is down: Rare on GoSiteMe due to high-availability infrastructure, but possible during maintenance.
  3. Connection limit reached: Too many concurrent connections exhausting the pool.
  4. Corrupted database tables: Crashed or corrupted tables preventing queries.
  5. Firewall blocking: IP-based restrictions preventing your application from connecting.

Step 1: Verify Credentials

Check your application's configuration file and compare the values against the database credentials shown in Dashboard → Hosting → Databases:

  • WordPress: Check wp-config.php for DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST.
  • Custom PHP: Check your connection file for the mysqli_connect() or PDO parameters.
  • Node.js: Check your .env file or configuration module for the DATABASE_URL.

If any value is wrong, update it and save the file. The connection should work immediately.

Step 2: Check Database Server Status

Go to Dashboard → Hosting → Databases and look at the server status indicator. Green means operational; yellow means degraded; red means down. If the server is down, GoSiteMe's infrastructure team is automatically notified. Check the status page for updates.

Step 3: Check Connection Limits

Each GoSiteMe plan has a maximum concurrent database connection limit:

PlanMax Connections
Starter25
Business100
Enterprise500+

If your application exceeds the limit, connections are refused. Optimize your code to close connections promptly and use connection pooling. Monitor active connections in Databases → Monitoring.

Step 4: Repair Corrupted Tables

  1. Go to Databases → phpMyAdmin (or the Database GUI in GoCodeMe IDE).
  2. Select the affected database.
  3. Check the tables that may be corrupted.
  4. Click Repair Table from the dropdown.
  5. For WordPress, add define('WP_ALLOW_REPAIR', true); to wp-config.php and visit /wp-admin/maint/repair.php.

Step 5: Check Firewall & Remote Access

If you are connecting from an external application, ensure your IP is whitelisted under Databases → Remote Access. GoSiteMe blocks external database connections by default for security. Add your server's IP address to allow access.

Contact Support

If none of these steps resolve the issue, contact GoSiteMe support with your domain name, the exact error message, and the time the issue started. Our team can check server-side logs for deeper diagnostics.

Was this answer helpful?