Difference between revisions of "PostgreSQL: CREATE USER"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
Tags: Mobile web edit, Mobile edit |
||
| Line 49: | Line 49: | ||
* {{TOC operation databases}} | * {{TOC operation databases}} | ||
* [[CREATE]] | * [[CREATE]] | ||
| − | * SUPERUSER | + | * [[SUPERUSER]] |
== See also == | == See also == | ||
Revision as of 11:56, 28 April 2022
create user, creates a new user in PostgreSQL
- Official documentation: https://www.postgresql.org/docs/13/sql-createuser.html
Contents
Examples
create user your_username
Create a new user
create user your_username; Output: CREATE ROLE
create user your_username; Output: ERROR: permission denied to create role
Create a new user with errors
create user your.username; Output: ERROR: syntax error at or near "."
create user your_username; ERROR: cannot execute CREATE ROLE in a read-only transaction
Create a new user and assign a password
CREATE USER your_username WITH ENCRYPTED PASSWORD 'your_pass'; Output: CREATE ROLE
CREATE USER your_username WITH ENCRYPTED PASSWORD 'your_pass'; Output: ERROR: role "your_username" already exists Solution: ALTER USER user_name WITH PASSWORD 'new_password';
Assign a role with GRANT command:
GRANT your_defined_role TO your_username;
Output:
GRANT ROLE
- CREATE USER username WITH CREATEUSER
Related terms
- Create database (PostgreSQL)
ALTER USER YOUR_USER WITH PASSWORD 'your_new_password';sudo -u postgres psqlGRANT- Connect to a database
- Show databases
- Create database
- Delete database
- Create user
- List users
- List databases
- List tables:
show tables - GRANT
- CREATE
- SUPERUSER
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), DML, DDL, SQL/MED, Group by, List users, SQL Injection, SQLAlchemy,CREATE USER, CREATE ROLE, EXPLAIN, ALTER DATABASE, REVOKE, NOLOCK, NOWAIT, EXISTS, Unique constraint,.sql, OpenSearch SQL, Transact-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, Patroni, Binary Data Types
Advertising: