Reputation: 58642
I'm trying to create database in psql via CLI.
psql -U postgres createdb portal
I kept getting
psql: warning: extra command-line argument "portal" ignored
psql: FATAL: database "createdb" does not exist
What did I do wrong ?
I'm not trying to queries any data.
Upvotes: 2
Views: 9333
Reputation: 51446
here I connect as user vao
to database postgres
(which always is there) and create database db1
in CLI
... The first argument without key is database name, so in your example createdb
is interpreted as dbname to connect to...
please look at documentation of psql
Vaos-MacBook-Air:tts vao$ bash -c "psql -U vao postgres -c 'create database db1;'"
CREATE DATABASE
Upvotes: 6