postgresql


This draft deletes the entire topic.

inline side-by-side expand all collapse all

Examples

I am downvoting this example because it is...

Syntax

  • CREATE USER niceusername with PASSWORD 'very-strong-password';

Parameters

Parameters

Remarks

Remarks

Still have a User management question? Ask Question

Create user and matching database

1

To support a given application, you often create a new user and database to match.

The shell commands to run would be these:

$ createuser -P blogger
Enter password for the new role: ⚫⚫⚫⚫⚫⚫⚫⚫
Enter it again: ⚫⚫⚫⚫⚫⚫⚫⚫

$ createdb -O blogger blogger

This assumes that pg_hba.conf has been properly configured, which probably looks like this:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    sameuser        all             localhost               md5
local   sameuser        all                                     md5

Create a user with a password

0

This will create a PostgreSQL user with niceusername username and very-strong-password password.

CREATE USER niceusername with PASSWORD 'very-strong-password';

Topic Outline