In today’s article, we will explain how to change the OWNER when creating a database and after it has been created in PostgreSQL.
PostgreSQL provides an ALTER DATABASE command that allows us to modify a database.
For instance, using ALTER DATABASE command, you can alter the database name, attributes, owner, etc.
In Postgres, the ALTER DATABASE command uses the OWNER TO clause to change/modify the database owner.
To change the owner while creating a database:
1 | CREATE DATABASE db1 WITH OWNER = faruk |
To change the owner after creating a database:
1 | ALTER DATABASE db1 OWNER TO faruk; |
![]()
Database Tutorials MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux 