Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

strapi v4 with postgres error, database does not exist

Tags:

strapi

I have tried to install the latest strapi version with the following command:

npx create-strapi-app@latest strapi_test

After going through the manual steps and choosing postgres as my db, from within my folder I run the yarn develop command, but then I get the following error:

debug: ⛔️ Server wasn't able to start properly.

error: database "strapi_test" does not exist

enter image description here

enter image description here

What have I done wrong? I am running node v16.13.0, npm v8.2.0 and on Mac OS Monterey v12.2.1

like image 978
user2371684 Avatar asked Sep 02 '25 03:09

user2371684


2 Answers

Had the same problem, turns out you need to create the database yourself with psql. So you need to run:

psql -U postgres

create database strapi_test;

It should work correctly after this.

like image 119
Unbound Avatar answered Sep 05 '25 00:09

Unbound


Just to add to what @Unbound said above:

What's missing from the equation, after installing PostegreSQL, is the psql command not being available globally. So what you have to do, is define the directory in the PATH variable globally. I had to look through the folders, to find the correct location of the executable, but in the end I ran this command (PostgreSQL 15):

export PATH=/Library/PostgreSQL/15/bin:$PATH

After running this command, psql worked wonders everywhere. You might have to start new terminal session as well - to see it work.

like image 24
Dāvis Avatar answered Sep 05 '25 00:09

Dāvis