# Installation

> Install OpenDB on Linux, macOS or Windows, start it for the first time and log in with the default account.

Source: https://www.opendb.tools/en/docs/installation

## Install OpenDB

The easiest way is to paste the command for your system in a terminal. It installs the latest version for your account, without administrator rights, checks its checksum and adds `opendb` to your `PATH`. The [download page](/en/download) also offers the packages to unpack yourself.

On Linux and macOS:

```bash
curl -fsSL https://github.com/audmbag/opendb/releases/latest/download/install.sh | sh
```

On Windows, in PowerShell:

```powershell
irm https://github.com/audmbag/opendb/releases/latest/download/install.ps1 | iex
```

If your computer lacks the version of the Visual C++ Redistributable that OpenDB needs, the installer downloads it from Microsoft's website and Windows asks for your approval.

The program goes to `~/.local/share/opendb` on Linux and macOS, and to `%LOCALAPPDATA%\opendb` on Windows. Open a new terminal if the `opendb` command is not found yet.

Once OpenDB is installed, check that the command answers:

```bash
opendb app:help
```

This command lists every OpenDB command. They are detailed in the [command reference](/en/docs/commands).

## Start the web interface

```bash
opendb serve
```

Then open `http://localhost:8000` in your browser.

## Update

```bash
opendb self-update
```

The command installs the latest version next to the current one. The previous one is kept: `opendb self-update --rollback` goes back to it.

## Uninstall

```bash
opendb uninstall
```

Once you confirm, the command removes the program and the `opendb` command, along with its `PATH` entry on Windows. Your data stays in `~/.opendb`: a new installation finds it again. To remove it too:

```bash
opendb uninstall --purge
```

> [!WARNING]
> `--purge` also deletes the encryption key: the saved database credentials and API keys are lost.

Stop `opendb serve` and the external agents that launch OpenDB over MCP first: the command refuses to remove a running version. `--yes` skips the confirmation, in a script for instance.

## First login

On first install, OpenDB creates a **root** account that holds every privilege.

| Field | Value |
|---|---|
| Username | `opendb` |
| Password | `opendb` |

> [!WARNING]
> Change this password right after your first login, in **Settings → Account**. Until you do, OpenDB shows a warning.

The root account is meant for administering the instance. For day-to-day work, create a personal account and give it a role. See [Users, roles and privileges](/en/docs/users-roles-privileges).

## Where OpenDB keeps its data

OpenDB writes everything into a single folder in your home directory (`%USERPROFILE%\.opendb` on Windows). It stays in place from one version to the next.

```text
~/.opendb/
├── config/.env                    encryption key and settings
├── database.sqlite                OpenDB's own database
├── projects/{project}/MEMORY.md   the agent's memory for this project
├── logs/agent.log                 the agent's requests and answers
├── logs/mcp.log                   calls made by external agents
├── logs/{cloning}/                the log of each cloning run
└── tmp/                           temporary working files
```

Your accounts, projects, conversations and privileges are stored in `database.sqlite`.

Sensitive information (database credentials, API keys, SMTP settings) is **encrypted** before it is stored. The encryption key lives in `~/.opendb/config/.env`.

> [!WARNING]
> Back up the `~/.opendb/config/.env` file. Without its key, stored credentials and API keys can no longer be decrypted.

## In your project folders

Each project is tied to a working folder that you choose. OpenDB creates one subfolder per user in it:

```text
{project folder}/.opendb/users/{user}/
├── sql/            SQL editor files
├── exports/        database exports
├── snippets.json   your query snippets
└── erd.json        the layout of your diagram
```

The `exports/` folder contains a `.gitignore` file: your exports never end up in the project's Git repository.

## Next step

Follow the [quick start](/en/docs/quick-start) to connect an AI provider and ask your first question.
