Bedrock 1.15.0 / phpdotenv:5.2 / Error: Error establishing a database connection

I think in addition to updating vlucas/phpdotenv, you need to change this line in config/application.php

$dotenv = Dotenv\Dotenv::createImmutable($root_dir);

To this
$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir);

I haven’t tested my local site yet, so this my guess.