· today i learned · 1 min read

How to Create the Initial Postgresql Database?

You just installed PostgreSQL and attempt to run psql and get the following error: FATAL: database 'user' does not exist. Here's how to fix it

How to Install PostgreSQL

You can use brew to install PostgreSQL:

  $ brew install postgresql

Start the process

You can use brew services to manage your processes like this:

  $ brew services start postgresql

Create the initial database

If you try starting the PostgreSQL console (using psql) and get the following error:

  psql: error: could not connect to server: FATAL:  database "user" does not exist

then you need to create the initial database using:

  $ createdb
  • postgresql

Related Posts

View All Posts »