Difference between revisions of "PostgreSQL: CREATE USER"

From wikieduonline
Jump to navigation Jump to search
Line 5: Line 5:
 
* <code>create user your_username</code>
 
* <code>create user your_username</code>
  
Create a new user:
+
=== Create a new user ===
 
  create user your_username;
 
  create user your_username;
 
  Output:
 
  Output:

Revision as of 20:12, 2 March 2022

create user, creates a new user in PostgreSQL

Examples

  • create user your_username

Create a new user

create user your_username;
Output:
CREATE ROLE

Create a new user with errors:

create user your.username;
Output:
ERROR:  syntax error at or near "."

Create a new user and assign a password:

CREATE USER your_username WITH ENCRYPTED PASSWORD 'your_pass';
Output:
CREATE ROLE
Assign a role with GRANT command:
GRANT your_defined_role TO your_username;

Related terms

See also

Advertising: