Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

petervandijck's avatar

Want to use PostGres but

OK, so I am using Valet (all good), and I am creating a new Laravel site with a postgres database.

When I run php artisan migrate, I get this error:

SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: FATAL:  database "simply-analyze" does not exist (Connection: pgsql, SQL: select * from information_schema.tables where table_catalog = simply-analyze and table_schema = public and table_name = migrations and table_type = 'BASE TABLE')

This is my .env file

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=simply-analyze
DB_USERNAME=postgres
DB_PASSWORD=

I have created the database in DBngin, where it shows up as PostGreSQL 15.1: 5432

What things should I check? (I am a newbie on the command line)

(When I create a Laravel site with mysql, it asks me to create the database, and that works fine.)

0 likes
6 replies
petervandijck's avatar

It seems postgres isn't running?

simply-analyze % psql -V
zsh: command not found: psql

Yet I can see that database in TablePlus via DBngin

petervandijck's avatar

This is coming from Laravel logs, this might help explain the issue? Where should I look?

[previous exception] [object] (PDOException(code: 7): SQLSTATE[08006] [7] connection to server at \"127.0.0.1\", port 3306 failed: received invalid response to SSL negotiation: J at /Users/petervandijck/code/simply-analyze/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:65)
[stacktrace]
petervandijck's avatar

And this.

So in DBnginx the database exists, but Laravel can't connect to it... what should I try next?

[previous exception] [object] (PDOException(code: 7): SQLSTATE[08006] [7] connection to server at \"127.0.0.1\", port 5432 failed: FATAL:  database \"simply-analyze\" does not exist at /Users/petervandijck/code/simply-analyze/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:65)
[stacktrace]
petervandijck's avatar

On the command line, it seems postgres isn;t running (even though it is running in DBngin):

simply-analyze % psql
zsh: command not found: psql
lara336223's avatar

@petervandijck I had this with HestiaCP Control Panel . I had to Open a 5432 Port at 0.0.0.0/0 for PostgreSQL to get a Script to Open, most odd.

Please or to participate in this conversation.