10.1. User Administration and User Rights

Like all other sophisticated databases, PostgreSQL allows the administrator to define users as well as user rights. This is important for many reasons: On the one hand, it helps you to protect your data from unauthorized access. On the other hand, it helps you to protect yourself. Just imagine various different tables—user rights can help you make sure that you do not accidentally delete important data from one of the tables.

10.1.1. Managing Users and Groups

To create new users, use the CREATE USER command. The next listing shows the syntax overview of the command:

phpbook=# \
							h
							CREATE USER Command: CREATE USER Description: define a new database user account Syntax: CREATE USER username [ [ WITH ] option ...

Get PHP and PostgreSQL: Advanced Web Programming 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.