Sam24
Sam24

Reputation: 21

I accidentally deleted the default postgres database

I accidentally deleted the default postgres database, and now I can not log into the psql command shell because it replies with the following error.

"psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "postgres" does not exist"

Is there a way to restore the database? or just recreate it?

Upvotes: 2

Views: 3789

Answers (1)

A. S.
A. S.

Reputation: 89

You can create the default database again. That should work for most cases.

Just run:

createdb postgres

before, remember to become postgres with sudo -i -u postgres

Upvotes: 5

Related Questions