> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# qovery database

> Database management commands

## Overview

Manage databases within your Qovery environment.

## Commands

### List Databases

List all databases in current environment:

```bash theme={null}
qovery database list
```

Show credentials in the output:

```bash theme={null}
qovery database list --show-credentials
```

**Flags:**

| Flag                 | Description       |
| -------------------- | ----------------- |
| `--organization`     | Organization Name |
| `--project`          | Project Name      |
| `--environment`      | Environment Name  |
| `--show-credentials` | Show Credentials  |
| `--json`             | JSON output       |

### Deploy Database

Deploy or start a database:

```bash theme={null}
qovery database deploy --database "my-db"
```

Deploy multiple databases at once:

```bash theme={null}
qovery database deploy --databases "db1,db2"
```

**Flags:**

| Flag             | Short | Description                                               |
| ---------------- | ----- | --------------------------------------------------------- |
| `--database`     | `-n`  | Database Name                                             |
| `--databases`    |       | Database Names (comma separated)                          |
| `--watch`        | `-w`  | Watch database status until it's ready or an error occurs |
| `--organization` |       | Organization Name                                         |
| `--project`      |       | Project Name                                              |
| `--environment`  |       | Environment Name                                          |

### Redeploy Database

Redeploy an existing database:

```bash theme={null}
qovery database redeploy --database "my-db"
```

**Flags:**

| Flag             | Short | Description                                               |
| ---------------- | ----- | --------------------------------------------------------- |
| `--database`     | `-n`  | Database Name (required)                                  |
| `--watch`        | `-w`  | Watch database status until it's ready or an error occurs |
| `--organization` |       | Organization Name                                         |
| `--project`      |       | Project Name                                              |
| `--environment`  |       | Environment Name                                          |

### Stop Database

Stop a running database:

```bash theme={null}
qovery database stop --database "my-db"
```

Stop multiple databases at once:

```bash theme={null}
qovery database stop --databases "db1,db2"
```

**Flags:**

| Flag             | Short | Description                                               |
| ---------------- | ----- | --------------------------------------------------------- |
| `--database`     | `-n`  | Database Name                                             |
| `--databases`    |       | Database Names (comma separated)                          |
| `--watch`        | `-w`  | Watch database status until it's ready or an error occurs |
| `--organization` |       | Organization Name                                         |
| `--project`      |       | Project Name                                              |
| `--environment`  |       | Environment Name                                          |

### Cancel Deployment

Cancel a database deployment:

```bash theme={null}
qovery database cancel
```

<Note>
  Use `qovery environment cancel` to cancel a database deployment.
</Note>

### Delete Database

Delete a database:

```bash theme={null}
qovery database delete --database "my-db"
```

Delete multiple databases at once:

```bash theme={null}
qovery database delete --databases "db1,db2"
```

<Warning>
  Deleting a database will permanently delete all data. Make sure you have backups before proceeding.
</Warning>

**Flags:**

| Flag             | Short | Description                                               |
| ---------------- | ----- | --------------------------------------------------------- |
| `--database`     | `-n`  | Database Name                                             |
| `--databases`    |       | Database Names (comma separated)                          |
| `--watch`        | `-w`  | Watch database status until it's ready or an error occurs |
| `--organization` |       | Organization Name                                         |
| `--project`      |       | Project Name                                              |
| `--environment`  |       | Environment Name                                          |

## Examples

### Deploy Database

```bash theme={null}
# Set context
qovery context set

# List available databases
qovery database list

# Deploy database
qovery database deploy --database "postgres-main"

# Watch deployment status
qovery database deploy --database "postgres-main" --watch
```

### Stop Database for Maintenance

```bash theme={null}
# Stop database
qovery database stop --database "postgres-main"

# Perform maintenance...

# Restart database
qovery database deploy --database "postgres-main"
```

### List Databases with Credentials

```bash theme={null}
qovery database list --show-credentials
```

### List Databases as JSON

```bash theme={null}
qovery database list --json
```

## Related Commands

* [`qovery application`](/cli/commands/application) - Manage applications
* [`qovery status`](/cli/commands/status) - Check database status
