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
| Platform | Command |
|---|
| Go install | go install github.com/jorgerojas26/lazysql@latest |
| macOS (Homebrew) | brew install lazysql |
| Arch Linux (AUR) | yay -S lazysql |
| Binary | download from the GitHub Releases page |
| Verify | lazysql --version |
Launching
| Command | Description |
|---|
lazysql | Open 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.sqlite3 | Open a SQLite file |
lazysql --help | Full option list |
Connection URLs
| Database | Example URL |
|---|
| MySQL | mysql://user:pass@host:3306/dbname |
| PostgreSQL | postgres://user:pass@host:5432/dbname |
| SQLite | sqlite3:///absolute/path.db or a file path |
| MSSQL | sqlserver://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
| Key | Action |
|---|
Ctrl+e | Open/edit a new connection |
Enter | Connect / open the selected item |
Tab / Backtab | Move between panes (tree, results, editor) |
L | Focus the SQL editor |
H | Focus the tables/sidebar |
q | Quit |
? | Help / keybinding reference |
Navigating Data
| Key | Action |
|---|
j / k | Move row down / up |
h / l | Move column left / right |
g / G | Jump to first / last row |
Ctrl+f / Ctrl+b | Page forward / back |
/ | Filter/search within results |
c | Edit the selected cell |
d | Delete the selected row |
o | Add a new row |
Running SQL
| Key/Action | Description |
|---|
Focus editor (L), type SQL | Write a query |
Ctrl+r | Run the current query |
| Results pane | Browse the returned rows |
| Multiple tabs | Keep 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
| Step | How |
|---|
| Edit a cell | Select it, press c, type, confirm |
| Stage changes | lazysql batches edits |
| Commit | Apply staged changes to the database |
| Discard | Drop 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
| Aspect | lazysql | Harlequin | psql/mysql CLI |
|---|
| Interface | TUI, multi-DB | TUI SQL IDE | Plain REPL |
| Keybindings | Vim-like | Editor-style | Readline |
| Data editing | Inline cell edit | Query-driven | SQL only |
| Best for | Browsing + light edits | Writing/iterating SQL | Scripting, admin |
Resources