On my first Lando install I could not enable a database connection. This was my error:

Failed to connect to your database server. The server reports the following message: 
SQLSTATE[HY000] [2002] No such file or directory.

I just took the Drupal 9 recipe and used "drupal9" as db credenctials and pass.


When I ran:

lando info

I was able to get some information. This piece gave me the answer:

 { service: 'database',
    urls: [],
    type: 'mysql',
    healthy: true,
    internal_connection: { host: 'database', port: '3306' },
    external_connection: { host: '', port: '64423' },

So when I changed hostname from localhost to database the error disappeared and I got to install Drupal.