Description
When trying to start a new environment using wp-env, the CLI issues the following error:
mysqlcheck: Got error: 1045: Access denied for user 'username_here'@'172.18.0.5' (using password: YES) when trying to connect
This issue is not specific to working locally using this repository, but exists wherever @wordpress/env is used.
Step-by-step reproduction instructions
- Destroy your local environment
npm run wp-env destroy
- Re-provision:
npm run wp-env start
Expect to see the errors. Should you not see the error, make sure your docker images are updated to the latest.
Quick Debugging
username_here was implemented in the WordPress docker image fairly recently (docker-library/wordpress@8f5bcc1#diff-7f28a0f62019f2d8b061638e8c3aea207404c1499f1c9241db3216fadd8f4530)
- the
wp-config.php in the WordPress container matches the default config in the PR listed above.
- the
wp-config.php includes the getenv_docker function that looks for a local env_FILE that does not exist in the WordPress container.
- When looking at the container using the docker desktop app, I see
No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying '/usr/src/wordpress/wp-config-docker.php' (WORDPRESS_DB_NAME)
Environment Info
Relevant NPM packages
├─┬ @wordpress/env@3.0.2
│ ├── chalk@4.0.0 deduped
│ ├── copy-dir@1.3.0
│ ├── docker-compose@0.22.2
│ ├── extract-zip@1.6.7
│ ├── got@10.7.0
│ ├── inquirer@7.1.0 deduped
│ ├── js-yaml@3.13.1
│ ├── ora@4.0.2
│ ├── rimraf@3.0.2 deduped
│ ├── simple-git@2.35.0
│ ├── terminal-link@2.0.0
│ └── yargs@14.0.0
WordPress information
trunk@647a41c
Description
When trying to start a new environment using
wp-env, the CLI issues the following error:This issue is not specific to working locally using this repository, but exists wherever
@wordpress/envis used.Step-by-step reproduction instructions
npm run wp-env destroynpm run wp-env startExpect to see the errors. Should you not see the error, make sure your docker images are updated to the latest.
Quick Debugging
username_herewas implemented in the WordPress docker image fairly recently (docker-library/wordpress@8f5bcc1#diff-7f28a0f62019f2d8b061638e8c3aea207404c1499f1c9241db3216fadd8f4530)wp-config.phpin the WordPress container matches the default config in the PR listed above.wp-config.phpincludes thegetenv_dockerfunction that looks for a localenv_FILEthat does not exist in the WordPress container.No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying '/usr/src/wordpress/wp-config-docker.php' (WORDPRESS_DB_NAME)Environment Info
Relevant NPM packages
WordPress information
trunk@647a41c