Skip to content

Introduction

dbmux is a command line tool for everyday PostgreSQL work. It wraps dump, restore, and query workflows behind short connection names, so you stop retyping hosts and passwords. Every dump and restore is recorded to a history you can list and clear later.

Installation

Install globally with npm:

bash
npm install -g dbmux

Or run the install script:

bash
curl -fsSL https://raw.githubusercontent.com/bhagyamudgal/dbmux/main/install.sh | bash

Quick start

Connect once. dbmux tests the connection, saves it under a name, and makes it the active session connection:

bash
dbmux connect -U "postgresql://user:password@localhost:5432/mydb"

Query the database without repeating any details:

bash
dbmux query -q "SELECT * FROM users LIMIT 10"

Create a dump. With no flags, dbmux shows a picker of live databases:

bash
dbmux dump create

Restore one of your recent dumps into a fresh database:

bash
dbmux restore run --fromHistory -d mydb_restored --create

Each step resolves its connection the same way: an explicit -n flag first, then the active session, then your configured default. The full order is described on the configuration page.

Commands

CommandDescription
connectConnect to a database and save it as a named connection
queryExecute SQL queries
listList databases, tables, or saved connections
dumpCreate, delete, and review database dumps
restoreRestore dumps and review restore history
dbDelete databases from the server
configManage configuration and saved connections
historyView and manage dump and restore history
statusShow the current default connection
disconnectClear the active connection session
updateUpdate dbmux to the latest version

Database support

PostgreSQL is fully supported today. SQLite appears in interactive prompts, but its driver is not implemented yet, so picking it fails once dbmux tries to reach the server. Dump, restore, and db delete are restricted to PostgreSQL.