0

I try to create a database. After reading around, I saw two methods:

Method 1:

xxxxxx:~$ sudo -i -u postgres
postgres$xxxx:~$ createdb mydb1

Method 2:

xxxxxx:~$ sudo -u postgres psql
postgres:# CREATE DATABASE mydb2

If I do method 1, the database mydb1 gets created. And when I am in postgres:# and do this \list, I can see mydb1 being listed. However, if I do method 2, after the end line above, there is no error whatsoever. But when I do \list in postgres:#, I don't the database mydb2 being listed.

My first time trying to set up a postgresql database. Please, if someone could explain what is going on.

1 Answer 1

2

In psql you need to end the sql with the semicolon:

create database mydb2;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.