Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhen a WordPress or MySQL container stops, its main process has exited. The reliable fix is not to add a restart policy first; it is to identify the first fatal log line, verify the Compose network and credentials, let MySQL finish initialization, and protect both data directories with persistent volumes. In most WordPress stacks, the database host must be the Compose service name such as db, the named database must already exist, and WordPress must use credentials that match MySQL’s initialized account.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
Start with the container’s actual state
Run these commands from the directory containing your Compose file:
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
docker compose ps -a
docker compose logs --tail=200 wordpress db
The first command shows whether each service is running, exited, restarting, or reporting a health state. The second shows the application and database output together, which makes startup ordering and connection failures easier to correlate. If you are not using Compose, replace the service names with container names:
docker logs CONTAINER
Read upward until you find the first fatal message. The last line is often only a restart notice and does not explain the failure. A bad command, missing file, permissions problem, refused database connection, and out-of-memory kill require different remedies.
#1 Best Overall
Interpret the Compose status
| Status | What it tells you | Next check |
|---|---|---|
| Exited | The container’s main process finished or failed. | Read its logs and inspect the exit state. |
| Restarting | A restart policy is repeatedly relaunching a process that still fails. | Find the first fatal line; temporarily remove the restart loop while diagnosing. |
| Up without a health signal | The process is running, but the service may not be ready to accept requests. | Test database connectivity and review initialization output. |
| Healthy | A configured health check is passing. | Check WordPress logs if the site still reports a database error. |
Inspect the exit state
Use the container identifier shown by docker compose ps -a:
docker inspect CONTAINER
Look for the state information, including the exit code, whether Docker recorded an out-of-memory kill, the configured command, and mounted volumes. A normal exit can be correct for a one-shot migration or CLI job; it is not automatically a crash. Conversely, an application that exits because its entrypoint cannot execute will keep failing even if Docker restarts it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Fix the WordPress-to-MySQL connection settings
Inside a Compose network, localhost means the WordPress container itself. It does not mean the MySQL container. Set WORDPRESS_DB_HOST to the database service name, commonly db in the official example. Both services must be attached to the same Compose network, which Compose normally creates automatically when they are declared in one project.
Match all four connection values
WordPress uses these variables:
WORDPRESS_DB_HOST: the Compose service name and, if needed, the MySQL port.WORDPRESS_DB_USER: the MySQL application user.WORDPRESS_DB_PASSWORD: that user’s password.WORDPRESS_DB_NAME: the database WordPress will use.
The MySQL service initializes corresponding values through MYSQL_USER, MYSQL_PASSWORD, and MYSQL_DATABASE, plus a root-password setting. The user, password, and database name must agree exactly. A typo, different capitalization, or an old password in one service produces the familiar WordPress message “Error establishing a database connection.”
Do not use an IP address as a permanent fix
Compose provides service-name DNS. A container IP can change whenever a service is recreated, while the service name remains the stable endpoint. Use db (or the actual service key in your file), not a copied address and not localhost.
Make sure the database already exists
Setting WORDPRESS_DB_NAME tells WordPress which database to open; it does not create that database. MySQL must have created the named database during initialization, or an administrator must create it separately.
Free tools Windows power users keep installed
One-click scans. No signup required.
This distinction matters after a failed or partial setup. Check the MySQL initialization output for database and user creation messages. If the database was never created, create it using a MySQL administrative connection, then grant the application user access. Do not assume that changing an environment variable in Compose will repair an existing data directory.
Why editing environment values may appear to do nothing
The official MySQL image applies many initialization variables only when its data directory is empty. Once /var/lib/mysql contains an initialized server, changing MYSQL_DATABASE, MYSQL_USER, or MYSQL_PASSWORD does not automatically rename a database, change an existing password, or recreate missing grants. Inspect the actual server state instead of treating a Compose-file edit as a migration.
If the old data is valuable, keep the volume and use SQL administration or a planned migration. Removing the volume can make initialization run again, but it also destroys the existing database unless you have a verified backup and intentionally accept that loss.
Account for MySQL’s asynchronous initialization
A newly created MySQL data directory performs initialization before the server accepts normal client connections. WordPress may start first, attempt a connection, and log a refusal even though MySQL is progressing normally. Keep the stack running and watch the database log until initialization completes.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Coordinate readiness instead of only startup order
Starting the db container before the wordpress container does not guarantee that MySQL is ready for queries. Add a database health check and make the application wait for a healthy dependency when your Compose version supports that condition, or implement a retry loop in the application startup path.
The MySQL official image documentation warns that applications which do not gracefully wait for MySQL may need a connect-retry loop before the service starts. A retry strategy should handle a temporary refusal and stop retrying with a clear error when credentials, the database name, or permissions are permanently wrong.
Watch for the completion signal
Follow the database output while it initializes:
docker compose logs -f db
Do not repeatedly delete and recreate the containers just because the first WordPress attempt failed. Recreating them can obscure the original message and, without persistent storage, can discard the partially initialized database.
Use persistent volumes for both services
Mount one persistent volume at MySQL’s data directory and another at WordPress’s document root. The usual paths are /var/lib/mysql and /var/www/html.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →volumes:
db_data:
wordpress_data:
The database volume preserves the initialized server, tables, users, and grants when the container is recreated. The WordPress volume preserves the core files, themes, plugins, uploads, and configuration stored under the document root.
What happens without persistence
- A recreated MySQL container can start with an empty data directory, so the expected database and user disappear.
- A recreated WordPress container can lose installed themes, plugins, uploads, and generated configuration.
- Environment variables may appear to work on one launch and fail on the next because initialization is being repeated on a different filesystem.
During diagnosis, do not run commands that remove volumes unless data destruction is intentional and a verified backup exists. A container can be safely replaced while its named volume remains attached.
Check entrypoints, commands, mounts, and permissions
If the first log line mentions an invalid command, missing executable, missing configuration file, or permission denial, the problem is local to the image startup path or a custom mount. A bind mount can hide files that the image supplied at that path; a custom command can replace the image’s intended entrypoint; and host ownership or mode settings can prevent the process from reading or writing its directories.
Isolate the last customization
- Save the current Compose file and identify custom
command,entrypoint, bind mounts, and user settings. - Temporarily run the official image with its default command and only the required environment values.
- Reintroduce one mount or command at a time, checking logs after each change.
- Verify that the mounted WordPress and MySQL paths exist and are writable by the process inside the image.
This process distinguishes an image or host-permission problem from a database configuration problem. Do not “fix” a permission error by recursively changing ownership on a production data directory without first confirming which UID the image uses and preserving a backup.
Rule out memory and other host resource failures
An out-of-memory kill is different from a refused database connection. Docker’s inspection output can indicate that the kernel killed the process for exhausting available memory. Check host metrics and the container state before changing application settings.
- If the host or Docker virtual machine has insufficient memory, allocate more or reduce concurrent workload.
- Check whether multiple services are competing for the same limited memory budget.
- Review disk capacity and inode availability when logs mention write failures or MySQL cannot extend files.
- After correcting the resource limit, start the service and confirm that it remains stable without a restart loop.
A restart policy cannot create memory, repair a full filesystem, or correct corrupted database files. It only starts the same failing process again.
Best Value
Use restart policies only after the cause is fixed
restart: always is appropriate for long-running WordPress and MySQL services that should recover after an unexpected crash or host reboot. It is not a substitute for valid credentials, an existing database, healthy storage, or a working entrypoint.
During troubleshooting, a restart loop can hide the useful output. Stop the loop or remove the policy temporarily, run the service in attached mode, and capture the first fatal message:
docker compose up
Compose’s attached up mode streams service logs as the processes start. Once the underlying error is corrected, restore the desired policy and verify a clean stop/start cycle. Docker documentation describes docker compose start as useful only for restarting containers that were previously created but stopped; it does not create missing containers or rebuild a broken configuration.
A safe Compose pattern to adapt
The following pattern shows the important relationships without embedding production passwords. Pin image tags appropriate for your deployment, store secrets securely, and add a health check or retry coordination if WordPress cannot tolerate a temporary refusal.
services:
db:
image: mysql
restart: always
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- db_data:/var/lib/mysql
wordpress:
image: wordpress
restart: always
depends_on:
- db
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
WORDPRESS_DB_NAME: wordpress
volumes:
- wordpress_data:/var/www/html
volumes:
db_data:
wordpress_data:
The service key db is the hostname WordPress uses. The database name and application credentials are deliberately identical on both services. The named volumes outlive container recreation. In production, replace the example names and variable values with your own secrets and a tested image-tag strategy; never copy example passwords into a public or shared deployment.
Recovery playbooks for common symptoms
WordPress exits immediately with a connection-refused message
- Run
docker compose ps -aand confirm whetherdbis still initializing or has exited. - Read
docker compose logs --tail=200 dband wait for initialization to finish if it is progressing. - Verify that
WORDPRESS_DB_HOSTisdb, notlocalhost. - Add a health check or application retry behavior if the refusal occurs only during startup.
MySQL exits with an initialization or permission error
- Read the first fatal line in the MySQL log.
- Confirm that the mounted data path is the intended volume and is writable by the image process.
- Inspect the volume’s existing contents before changing environment variables.
- If the data is disposable, remove and recreate the volume only after explicitly accepting data loss; otherwise repair or migrate the existing server.
WordPress reports “error establishing a database connection” after a password change
- Compare the four WordPress connection variables with the actual MySQL user, password, database, and host.
- Remember that an already initialized data directory may retain the old password despite a new
MYSQL_PASSWORDvalue in Compose. - Test the existing MySQL account or change it administratively, then update WordPress to match.
- Restart WordPress only after the database accepts the credentials.
Everything worked until the stack was recreated
- Check whether
/var/lib/mysqland/var/www/htmlwere backed by named volumes or equivalent persistent mounts. - If the database volume is missing, determine whether a backup or snapshot can restore it before running initialization again.
- Recreate the services while retaining the correct volumes, then verify the database and WordPress files before opening the site.
The container keeps restarting with no useful information
- Run
docker compose logs --tail=200 wordpress dband inspect the earliest error, not the repeated restart line. - Use
docker inspect CONTAINERto check the exit code and out-of-memory status. - Temporarily remove
restart: alwaysor rundocker compose upin attached mode. - Fix the command, mount, credential, database, permission, or resource issue identified by the logs, then re-enable automatic restarts.
When a normal exit is the correct behavior
Not every stopped container is broken. A migration, backup, or administrative CLI container may intentionally run one command and exit with success. Such a job should be invoked when needed rather than given restart: always. Reserve automatic restarts for services whose main process is designed to remain running, such as the WordPress web process and MySQL server.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsA repeatable checklist
- Inspect status with
docker compose ps -a. - Read the first fatal line from WordPress and MySQL logs.
- Inspect the container state and exit information.
- Use the Compose database service name in
WORDPRESS_DB_HOST. - Match WordPress credentials and database name to the initialized MySQL server.
- Confirm that the named database exists; WordPress will not create it.
- Wait for MySQL initialization or add health and retry coordination.
- Keep persistent volumes mounted at the MySQL and WordPress data paths.
- Check entrypoints, commands, mounts, ownership, memory, and disk space.
- Apply a restart policy only after the underlying error is understood and corrected.
This sequence prevents the most damaging diagnostic mistake: repeatedly recreating containers, losing the evidence in their logs, and deleting the data that would have revealed whether the problem was configuration or initialization.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

