I just installed PostgreSQL 8.4.7 with EnterpriseDB’s one-click installer on Mac OS 10.6.6. I would like to reproduce the following command from Ubuntu:
sudo -u postgres createuser --createdb --no-createrole --pwprompt --no-superuser [username]
but I’m unsure how to do this. An early version using dscl and taking care of the pwprompt option is
dscl -p localhost -create /Users/[username]
but I’m at a loss of how to apply the createdb, no-createrole and no-superuser options.
Any input would be greatly appreciated!
createuseris about creating users inside the postgresql database, not (directly) to do with your local system users, which is whatdsclseems to be for.If your one-click install didn’t include the
createusercommands etc., don’t worry: they are just wrappers for invoking administrative SQL commands and their functionality can be performed from psql anyway. For example, thecreateusersystem command maps to theCREATE USERSQL command: http://www.postgresql.org/docs/9.0/static/sql-createuser.htmlIf you can connect to your newly-installed postgres database using psql (e.g.
psql -U postgres postgres) then you don’t need the other commands.