Skip to content

lazysql - Terminal Database Management Cheatsheet

lazysql - Terminal Database Management Cheatsheet

lazysql is a cross-platform terminal UI for managing databases, written in Go (in the spirit of lazygit/lazydocker). It connects to MySQL, PostgreSQL, SQLite, and MSSQL, and lets you browse schemas and tables, run SQL, page through results, and edit rows — with Vim-like keybindings, multiple connections, and tabbed views — all without leaving the terminal.

Installation

PlatformCommand
Go installgo install github.com/jorgerojas26/lazysql@latest
macOS (Homebrew)brew install lazysql
Arch Linux (AUR)yay -S lazysql
Binarydownload from the GitHub Releases page
Verifylazysql --version

Launching

CommandDescription
lazysqlOpen the connection manager
lazysql "mysql://user:pass@localhost:3306/db"Connect via URL
lazysql "postgres://user:pass@localhost:5432/db"PostgreSQL URL
lazysql /path/to/file.sqlite3Open a SQLite file
lazysql --helpFull option list

Connection URLs

DatabaseExample URL
MySQLmysql://user:pass@host:3306/dbname
PostgreSQLpostgres://user:pass@host:5432/dbname
SQLitesqlite3:///absolute/path.db or a file path
MSSQLsqlserver://user:pass@host:1433?database=dbname

Saved connections persist in lazysql’s config so you can pick them from the manager next time.

Core Keybindings

KeyAction
Ctrl+eOpen/edit a new connection
EnterConnect / open the selected item
Tab / BacktabMove between panes (tree, results, editor)
LFocus the SQL editor
HFocus the tables/sidebar
qQuit
?Help / keybinding reference
KeyAction
j / kMove row down / up
h / lMove column left / right
g / GJump to first / last row
Ctrl+f / Ctrl+bPage forward / back
/Filter/search within results
cEdit the selected cell
dDelete the selected row
oAdd a new row

Running SQL

Key/ActionDescription
Focus editor (L), type SQLWrite a query
Ctrl+rRun the current query
Results paneBrowse the returned rows
Multiple tabsKeep several queries/result sets open
-- In the editor pane, then Ctrl+r to run
SELECT id, email, created_at
FROM users
WHERE created_at > NOW() - INTERVAL 7 DAY
ORDER BY created_at DESC;

Editing Workflow

StepHow
Edit a cellSelect it, press c, type, confirm
Stage changeslazysql batches edits
CommitApply staged changes to the database
DiscardDrop staged changes before commit

Common Workflows

# Inspect a local SQLite database quickly
lazysql ./app.db

# Connect to a dev Postgres and browse tables
lazysql "postgres://dev:dev@localhost:5432/myapp?sslmode=disable"

# Keep multiple connections and tabs for a migration review
lazysql   # add connections in the manager, switch with tabs

lazysql vs Other DB Clients

AspectlazysqlHarlequinpsql/mysql CLI
InterfaceTUI, multi-DBTUI SQL IDEPlain REPL
KeybindingsVim-likeEditor-styleReadline
Data editingInline cell editQuery-drivenSQL only
Best forBrowsing + light editsWriting/iterating SQLScripting, admin

Resources