Skip to main content
Neon Postgres Docs

Search documentation

Type to search this documentation.

On this pageOverview

Neon CLI command: databases

List, create, and delete databases in a Neon project

The databases command lists, creates, and deletes databases in a Neon project from the terminal. For information about databases in Neon, see Manage databases. If --project-id is omitted, the CLI resolves it from your context file, auto-selects when your account has only one project, and otherwise asks you to pass --project-id.

Subcommands: create, delete, list

Lists databases. If you don't specify a branch ID or name with --branch, the command targets the project's default branch. This applies to all databases subcommands.

Bash
neon databases list [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon databases list --branch br-autumn-dust-190886
text
┌────────┬────────────┬──────────────────────┐
│ Name   │ Owner Name │ Created At           │
├────────┼────────────┼──────────────────────┤
│ neondb │ daniel     │ 2023-06-19T18:27:19Z │
└────────┴────────────┴──────────────────────┘

Creates a database. If you don't specify --owner-name, the current user becomes the database owner.

Bash
neon databases create [options]
Option Description Type Default Required
--name Database name string — Yes
--owner-name Owner name string — No
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon databases create --name mynewdb --owner-name john
text
┌─────────┬────────────┬──────────────────────┐
│ Name    │ Owner Name │ Created At           │
├─────────┼────────────┼──────────────────────┤
│ mynewdb │ john       │ 2023-06-19T23:45:45Z │
└─────────┴────────────┴──────────────────────┘

Deletes a database. The <database> is the database name.

Bash
neon databases delete <database> [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon databases delete mydb
text
┌─────────┬────────────┬──────────────────────┐
│ Name    │ Owner Name │ Created At           │
├─────────┼────────────┼──────────────────────┤
│ mydb    │ daniel     │ 2023-06-19T23:45:45Z │
└─────────┴────────────┴──────────────────────┘
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu