Error establishing database connection - Bedrock w/ Lando

Hello!

I’ve set up Bedrock with Lando as below, but when running lando start I get the ‘Error establishing a database connection’ error.

Lando.yml

name: site-staging
recipe: wordpress
config:
  webroot: app/web
  via: nginx
  database: mariadb
  xdebug: true
services:
  appserver:
    type: php:8.2 # Bedrock requires PHP >= 8.0

and then my .env

DB_NAME="wordpress"

DB_USER="wordpress"

DB_PASSWORD="wordpress"

# Optionally, you can use a data source name (DSN)

# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables

# DATABASE_URL='mysql://database_user:database_password@database_host:database_port/database_name'

# Optional database variables

DB_HOST="database"

#DB_PREFIX=wp_

WP_ENV="development"

WP_HOME="http://staging.lndo.site"

WP_SITEURL="${WP_HOME}/wp"

# Specify optional debug.log path

# WP_DEBUG_LOG='/path/to/debug.log'

# Generate your keys here: https://roots.io/salts.html
SALTS HERE...

Folder structure as below:
site-folder
- lando.yml

  • app
    • config
    • vendor
    • web
      - .env
    • .gitignore
    • composer.json
    • composer.lock
    • etc…

Your Lando config is slightly different than the one in our docs. Maybe give the one from our docs a shot instead?