[wp-trac] [WordPress Trac] #64579: Build: env:install fails intermittently with database connection refused
WordPress Trac
noreply at wordpress.org
Sun Feb 1 04:02:56 UTC 2026
#64579: Build: env:install fails intermittently with database connection refused
------------------------------+-----------------------------
Reporter: kraftbj | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
The env:install script (tools/local-env/scripts/install.js) can fail
intermittently with "Database connection error (2002) Connection refused"
when the database container reports healthy but isn't yet accepting
connections.
**Steps to reproduce:**
1. Run npm run env:start && npm run env:install
2. Occasionally fails with connection refused error
**Root cause:**
The first wp_cli() call runs immediately without waiting for the database:
{{{
#!js
// Line 13 - runs immediately with no wait
wp_cli( config create --dbname=wordpress_develop --dbuser=root
--dbpass=password --dbhost=mysql --force );
}}}
The Docker healthcheck uses mysqladmin ping / mariadb-admin ping, which
can pass before the database is ready to accept authenticated connections
from other containers.
This causes intermittent CI failures across random PHP/MariaDB
combinations (different jobs fail each run).
**Related:**
- [https://github.com/WordPress/wordpress-
develop/actions/runs/21555815308/job/62111814639 Example CI failure]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64579>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list