Lajos Arpad
Lajos Arpad

Reputation: 76444

Why is PostgreSQL not finding my newly created database

I'm an absolute noob in PostgreSQL and I am trying to do some things. My current experiment is to do some backups. I run

psql -h /tmp -p 6773 -d postgres

here I create a database called backups:

CREATE DATABASE backups;

I quit from this:

\q

and now I run

pgbench -i backups

however, this gives me an error:

connection to database "backups" failed:
FATAL:  database "backups" does not exist

What am I missing?

Upvotes: 0

Views: 242

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246318

All PostgreSQL client programs take the same connection options:

  • -h for the host
  • -p for the port
  • -U for the user

Some programs use -d for the database, some need the database as an argument to the command.

In your case, since you used a non-default -h and -p option to connect with psql, you should use the same options for pgbench.

Upvotes: 1

Related Questions