roots / bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure
https://roots.io/bedrock/
MIT License
6.15k stars 1.16k forks source link

WP CLI occurs “Error establishing a database connection.” in Bedrock project #724

Closed Sergey98Am closed 3 months ago

Sergey98Am commented 3 months ago

Version

6.5.3

What did you expect to happen?

It should added ThemeOptions with wp command

What actually happens?

I use Bedrock and Sage with Pantheon. I have installed WP CLI globally, but some commands do not work, for example wp cache, wp cron, wp comment…, it occurs Error: Error establishing a database connection. In .env file db settings were these

DB_NAME='wordpress'
DB_USER='root'
DB_PASSWORD=
DB_HOST='database'

After searching this issue, I have changed DB_HOST from database to localhost and destroyed db using lando destroy command, but the result is the same. How can I fix this issue?

In addition, I want to use WP CLI for acf-composer package.

Steps to reproduce

  1. Add WordPress+Bedrock+Sage project on Pantheon
  2. Install WP CLI globally
  3. Clone repository from Pantheon
  4. Add .env file
  5. Init lando using pantheon in the current directory command
  6. Start lando
  7. Check wp commands

System info

No response

Log output

No response

Please confirm this isn't a support request.

No

Log1x commented 3 months ago

Please create a topic on Discourse for support.

Sergey98Am commented 3 months ago

Thank you @Log1x. I have created a topic already.

Log1x commented 3 months ago

That appears to be a link to a private message.

Sergey98Am commented 3 months ago

Sorry @Log1x. I thought that was a way to create a topic. Honestly, I cannot find a way to open a topic on roots. I'm opening a Topic, but I cannot create a topic.

Screenshot from 2024-05-27 15-27-34 (1)

Can you tell me how to open a topic on roots, if it is not difficult?