Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to add a user and give the createdb permission to it in the PostgreSQL from a Ubuntu command line! I know this can be done by going inside consul and run this:

ALTER USER joe CREATEDB

But I want to do it from Ubuntu command line!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use createuser.
While logged in to your server as the postgres OS user:

createuser --createdb joe

Or, if you are some other user with the necessary sudo privileges:

sudo -u postgres createuser --createdb joe

Find more command-line options in the manual or with:

man createuser
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.