Difference between revisions of "PostgreSQL: CREATE USER"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
|||
Line 15: | Line 15: | ||
[[CREATE ROLE]] | [[CREATE ROLE]] | ||
− | Assign a role with | + | Assign a role with <code>[[GRANT]]</code> command: |
+ | GRANT [[your_defined_role]] TO your_username; | ||
* [[List users]]: <code>[[\du]]</code> | * [[List users]]: <code>[[\du]]</code> |
Revision as of 15:27, 2 March 2022
create user
, creates a new user in PostgreSQL
- Official documentation: https://www.postgresql.org/docs/13/sql-createuser.html
Examples
create user your_username
Create a new user:
create user your_username; Output: CREATE ROLE
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
- Create database (PostgreSQL)
ALTER USER YOUR_USER WITH PASSWORD 'your_new_password';
sudo -u postgres psql
GRANT
- Connect to a database
- Show databases
- Create database
- Delete database
- Create user
- List users
- List databases
- List tables:
show tables
- GRANT
See also
- PostgreSQL:
psql
,.psqlrc, .pgpass
,$HOME/.pg service.conf
,-U, -W, -d
, meta-commands:\du, \dg, \ddp, \dp, \list, \dn, \dt, \c, \l, \di, \q
,show users
,show
,su - postgres
,psql -c, \?, \connect, \conninfo
,--version, --help
, PL/pgSQL - SQL, NewSQL, RDMS: GraphQL (2015), SQLite,
select, insert
,select count
, Distributed SQL, TablePlus, Cache hit ratio,pg_stat_user_tables
,EXPLAIN
, Index (PostgreSQL), DDL, SQL/MED, Group by, List users, SQL Injection, SQLAlchemy,CREATE USER, CREATE ROLE, EXPLAIN, ALTER DATABASE, REVOKE, NOLOCK, NOWAIT, EXISTS
, Unique constraint,.sql
- PostgreSQL:
pg_dump, pg_restore
,pgAdmin, pg_config, psql, pg_ctl, pg_isready, initdb
, Role, Schema, DBeaver, Navicat, DataGrip, OmniDB,Adminer
, docker-compose.xml PostgreSQL, PostgreSQL version, PostgreSQL logs,postgresql.conf
,pg_hba.conf, $HOME/.pg_service.conf
, Create database (PostgreSQL), Create user,createdb
,GRANT
,pg_stat
, PostgreSQL VACUUM, EXPLAIN,pg stat activity
, Autovacuum, ALTER DATABASE, PostgreSQL statistics collector, Shared buffers, EXPLAIN (PostgreSQL),EXPLAIN ANALYZE
, Bitmap scan,EXPLAIN VERBOSE
,EXPLAIN VERBOSE (PostgresSQL)
,WAL
,ALTER USER
,CREATE ROLE, CREATE USER
,\du
,show users
,\l
, The Statistics Collector, pganalyze,cron.schedule
, Master,pg_tables
, PostgreSQL replication,CREATE, SET
, TOAST, PgBouncer, Restore DB, Index, meta-commands, Table, foreign table, Schema, Sequence, Views, materialized view, Table Partitioning, monitoring, PostgreSQL System Administration Functions, PostgreSQL extension, privileges, logging, PGTune, PostgreSQL parameter tunning, PostgreSQL modules, pgbench, PostgreSQL users, catalogs
Advertising: