Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a Superuser in postgres

Tags:

i'm looking for setup a Rails Environment with Vagrant, for that purpose the box it's been provisioned through bash shell method and includes among others this line:

sudo -u postgres createuser <superuserusername> -s with password '<superuserpassword>'

but i'm getting a configuration error, createuser: too many command-line arguments (first is "with")

can you help me with the correct syntax for create a Superuser with a password. Thanks

like image 401
Joseph Palmezano Avatar asked Sep 17 '19 13:09

Joseph Palmezano


1 Answers

Do it in a single statement within psql:

CREATE ROLE username WITH LOGIN SUPERUSER PASSWORD 'password';

e.g

CREATE ROLE dummy WITH LOGIN SUPERUSER PASSWORD '123456';

like image 125
user218867 Avatar answered Sep 19 '22 13:09

user218867