HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

createdb — Create a PostgreSQL database. More information: <https://www.postgresql.org/docs/current/app-created

Submitted by: @import:tldr-pages··
0
Viewed 0 times
createcommanddatabasecliinformationpostgresqlmorecreatedb

Problem

How to use the createdb command: Create a PostgreSQL database. More information: <https://www.postgresql.org/docs/current/app-createdb.html>.

Solution

createdb — Create a PostgreSQL database. More information: <https://www.postgresql.org/docs/current/app-createdb.html>.

Create a database owned by the current user:
createdb {{database_name}}


Create a database owned by a specific user with a description:
createdb {{[-O|--owner]}} {{username}} {{database_name}} '{{description}}'


Create a database from a template:
createdb {{[-T|--template]}} {{template_name}} {{database_name}}

Code Snippets

Create a database owned by the current user

createdb {{database_name}}

Create a database owned by a specific user with a description

createdb {{[-O|--owner]}} {{username}} {{database_name}} '{{description}}'

Create a database from a template

createdb {{[-T|--template]}} {{template_name}} {{database_name}}

Context

tldr-pages: common/createdb

Revisions (0)

No revisions yet.