My Host Says MySQL Is Up but WordPress Still Cannot Connect

Your hosting dashboard says MySQL is running, but your WordPress site displays “Error establishing a database connection.” That status is frustrating—but it does not prove WordPress can reach the database, log in, or select the right database. “MySQL is up” usually confirms only that a database service is running somewhere on the server. The failure may still be caused by a wrong database name, incorrect credentials, missing database user privileges, an incorrect hostname, or a server resource problem.

Start with the fastest reversible checks. Do not reinstall WordPress, delete database users, or install troubleshooting plugins during an outage. Before changing settings, record the exact error and time, then make a copy of the file you plan to edit. This guide walks through a safe triage process, including the difference between socket and TCP MySQL Visit this site connections, how to check wp-config.php, and what to ask your host to verify.

First, Capture the Error and Time

Before making changes, write down what you see and when you saw it. WordPress may show a generic connection message while the server logs contain a more specific clue, such as “Access denied,” “Unknown database,” or “No such file or directory.” Those messages point to different causes.

    Record the exact text shown in the browser, including any error code. Note the date, time, and time zone of at least one failed visit. Check whether the outage affects the whole site, only the admin area, or only some pages. Ask whether the hosting account, database, or site was recently moved, restored, or reconfigured.

Keep this scratchpad as you investigate. If you contact support, the exact error and timestamp give them a useful starting point. Avoid posting database passwords or full configuration files in a support ticket or public forum.

Rapid Triage: Check the Reversible Things First

Check the hosting status page. Look for a database outage, maintenance notice, or issue affecting your server or account. A green MySQL indicator is helpful, but it is not a test of your site’s specific connection. Check whether the problem is temporary. Reload the site once or twice, preferably in a private browser window. Do not repeatedly refresh if the site is under heavy load. Check for a recent change. A password reset, migration, restore, database rename, hosting plan change, or edited configuration file can break the connection even while MySQL remains online. Check the hosting account’s resource and storage status. Look for disk space limits, memory or process limits, and account suspension notices. A full disk or overloaded server can prevent normal database activity.

Do not change several settings at once. If a correction works, you want to know which change fixed the problem. If it does not, you need to be able to restore the previous state.

What “MySQL Is Up” Does—and Does Not—Mean

A database service can be running while WordPress still cannot use it. The site has to connect to the right server, authenticate with the right username and password, select an existing database, and use a database account that has permission to work with that database.

Possible failure What it may look like What to verify Wrong database name “Unknown database” or a connection error The database name in wp-config.php matches the account’s actual database name Bad username or password “Access denied” or a generic WordPress error The current database credentials match the hosting panel Missing database user privileges Login may fail or WordPress may be unable to use the database properly The user is assigned to the correct database with the required permissions Wrong host or connection method Timeout, connection refused, or socket-related error The host’s required database hostname and connection method Server or account problem Intermittent failures or connection limits Database logs, resource limits, disk space, and server health

Check the Database Details in wp-config.php

The main WordPress database settings are in the wp-config.php file in the site’s WordPress directory. Depending on your hosting setup, you may access it through the host’s file manager or a secure file transfer tool.

Before editing it, download a copy to your computer or create a clearly named backup in the same directory. Protect this file: it contains sensitive connection information. Do not send it unredacted to anyone.

define( 'DB_NAME', 'your_database_name' ); define( 'DB_USER', 'your_database_user' ); define( 'DB_PASSWORD', 'your_database_password' ); define( 'DB_HOST', 'localhost' );

1. Verify the Database Name

A wrong database name is a common cause after a migration, restore, or hosting account change. Hosting providers often add an account prefix, so the actual name may not match the shorter name you expect. Compare DB_NAME with the exact database name shown in your hosting control panel. Do not guess it or copy a database name from an old installation.

image

2. Verify the Database Username and Password

Check that DB_USER is the database user—not your WordPress administrator username, hosting login, or server login. Confirm the password using the provider’s database management tools. If you are unsure whether it is correct, use the hosting panel’s documented password-reset process, then update the matching value in wp-config.php.

A password reset is a coordinated change: if the panel changes the database user’s password but WordPress still has the old one, the site will remain disconnected. Avoid adding quotes incorrectly or including spaces when copying a password. If the password contains special characters, preserve the exact value and quoting syntax.

3. Check Database User Privileges

The database account must be assigned to the correct database. A valid username and password are not enough if that user has no access to the database WordPress needs. In your hosting panel, check that the user is attached to the database named in DB_NAME and has the permissions WordPress requires. Providers label this area differently; look for options such as “Manage Users,” “Assign User to Database,” or “Database Privileges.”

Do not remove users or grant broad privileges to every database as a test. If you are not sure what permissions are appropriate, ask the host to confirm the existing assignment and repair it without changing unrelated databases.

Socket vs TCP MySQL: Why the Hostname Matters

The value of DB_HOST tells WordPress where and how to connect. On some hosting plans, localhost uses a local Unix socket—a special file that lets programs on the same server communicate with MySQL. On other setups, MySQL connections use TCP, a network connection to a hostname or IP address. This distinction is the reason a socket vs TCP MySQL mismatch can cause a connection failure even when the database service is running.

Some providers use localhost; others require a specific database hostname, sometimes with a port. Do not assume one is universally correct. A socket error may mention a missing file or inability to connect through a socket. A TCP failure may mention a timeout, refused connection, or an unavailable host. The error text is a clue, not proof, so verify the required value with your provider.

What changed: If your host confirms the correct database hostname, change only DB_HOST to the exact value they provide, then save the file.

How to roll back: Restore the backed-up wp-config.php or return DB_HOST to its recorded previous value. If the change does not help, do not keep trying random hostnames.

Ask the Host a Specific, Useful Question

“Is MySQL up?” is too broad to diagnose this issue. Give support the timestamp and ask them to verify the connection path from your website’s server to its assigned database. You can use this script:

“WordPress has shown ‘[paste exact error]’ since [date and time, including time zone]. My site is [domain or account identifier]. Please confirm the correct database hostname and whether this account should connect using a local socket or TCP. Please also verify that database [name] exists, database user [username—do not include the password] is assigned to it with the required privileges, and there are no connection-limit, disk-space, or server-side errors at that timestamp. If available, please check the database error log and tell me the exact failure reason.”

Do not include your database password in the ticket. If support requests a configuration file, ask how to share it securely and redact secrets unless they specifically need them through an approved private channel.

Check Hosting and Server Health

If the configuration looks correct, the issue may be outside WordPress. Check the hosting panel for disk usage, account limits, database connection limits, and service alerts. A database can be running but unable to accept more connections, or the account may have reached a resource limit. A recent traffic spike, automated backup, scheduled task, or compromised site can contribute to load, but do not assume the cause without evidence.

If the error is intermittent, record a few timestamps and ask the host to compare them with database and server logs. If it is constant, ask whether the database was moved, the server hostname changed, or the account’s database access was restricted. The host can test from the server side whether WordPress’s web server can reach the database service.

image

Test Carefully, Without Making the Outage Worse

After correcting a confirmed value, load the site once and check both a public page and the WordPress login page. If the error changes, record the new message and time. Do not enable detailed error display on a public production site: database errors can expose private information. If you need WordPress or server debugging, use a private, controlled method and turn it off again after diagnosis.

A successful database connection may still reveal a separate issue, such as a maintenance screen, a plugin error, or a missing table. Treat that as a new symptom and preserve the current working configuration before investigating further.

Safe Fix Checklist

    Record the exact error and timestamp before changing anything. Back up wp-config.php before editing it. Confirm the exact database name, username, password, and host with the hosting panel. Verify the database user is assigned to the correct database with appropriate privileges. Ask whether the host expects a socket-based localhost connection or a TCP hostname. Make one confirmed change at a time and test the site. Write down what changed and how to restore the previous value. Do not share passwords, delete databases, or make unrelated configuration changes.

Conclusion

“MySQL is up” does not guarantee that WordPress is connecting to the right database with the right credentials and permissions. Start with the reversible checks: capture the error and timestamp, inspect the hosting status, and verify the values in wp-config.php. Pay particular attention to https://stateofseo.com/how-do-payment-plans-work-for-criminal-lawyers-in-brisbane/ a wrong database name, database user privileges, and whether the provider expects a socket or TCP connection.

Back up before editing, change one confirmed setting at a time, and keep a rollback path. If the settings match but the site still cannot connect, give your host the exact error and timestamp and ask them to check the connection from your web server to the assigned database—not just whether MySQL is running.