Creating Database Users in PostgreSQL

To create a database user, you use su to become the user postgres from the Linux root account. You can then use the PostgreSQL createuser command to quickly create a user who is allowed to access databases or create new database users, as follows:

matthew@seymour:~$ createuser heatherShall the new user be allowed to create databases? (y/n) yShall the new user be allowed to create more new users? (y/n) yCREATE USER

In this example, the new user named phudson is created and allowed to create new databases and database users. (Carefully consider who is allowed to create new databases or additional users.)

You can also use the PostgreSQL command-line client to create a new user by ...

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.