As mentioned in the subject line when I try to login to an angular app using Laravel on the backend from Windows 11 using a docker container running PostgreSQL I get the following error: SQLSTATE[08006] [7] connection to server at “localhost” (::1), port 9445 failed: Connection refused?
If I do the same thing in DBeaver the connection works as expected!
What could the problem be? Please find screenshots & code below:
Laravel config > database.php file
'default' => env('DB_CONNECTION', 'pgsql'),
...
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '9445'),
'database' => env('DB_DATABASE', 'phone-book'),
'username' => env('DB_USERNAME', 'dev'),
'password' => env('DB_PASSWORD', '123456789'),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
...
.env file
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=9445
DB_DATABASE=phone-book
DB_USERNAME=dev
DB_PASSWORD=123456789