LazySQL: Revolutionizing Terminal-Based Database Management
Tired of juggling bloated GUI tools and complex SQL commands? Discover how LazySQL transforms terminal workflows for database professionals.
The Database Management Dilemma
Database administration presents a universal challenge for developers:
-
GUI tools consume excessive resources and launch slowly -
Command-line interfaces require memorizing intricate syntax -
Context switching disrupts workflow efficiency -
Multi-database environments demand disparate tools
LazySQL solves these pain points—an open-source terminal UI (TUI) tool inspired by Lazygit. It blends visual intuitiveness with command-line efficiency, supporting MySQL, PostgreSQL, SQLite, and MSSQL without leaving your terminal.
Core Functionality Explained
Cross-Platform Compatibility
Works seamlessly across:
-
macOS -
Windows -
Linux
Efficiency Optimizations
-
Vim keybindings for keyboard-centric navigation -
Tabbed interfaces for concurrent database operations -
Unified management of multiple database connections
Integrated SQL Editor
CTRL + E // Open SQL editor
CTRL + R // Execute current statement
CTRL + Space // Launch external editor (Linux)
Data Interaction Features
-
Visual table browsing with filtering -
Row-level CRUD operations -
Real-time data refreshes
Installation Guide
macOS (Homebrew)
brew tap jorgerojas26/lazysql
brew install lazysql
Go Environment
go install github.com/jorgerojas26/lazysql@latest
Other Platforms
Download precompiled binaries from releases page:
OS | Method |
---|---|
Arch Linux | paru -S lazysql or yay -S lazysql |
Windows | Direct .exe execution |
Linux | Architecture-specific binaries |
Configuration Essentials
Configuration paths vary by OS:
OS | Configuration Path |
---|---|
Windows | %APPDATA%\lazysql\config.toml |
macOS | ~/Library/Application Support/lazysql/config.toml |
Linux | $XDG_CONFIG_HOME/lazysql/config.toml |
Sample Configuration:
[[database]]
Name = 'Production DB'
Provider = 'postgres'
URL = 'postgres://user:pass@localhost:5432/prod_db'
Commands = [
{ Command = 'ssh -tt bastion -L 5432:localhost:5432', WaitForPort = '5432' }
]
[application]
DefaultPageSize = 100
DisableSidebar = false
Practical Workflow Guide
Establishing Connections
-
Launch with lazysql
-
Press n
to create new connection -
Enter name and URL (e.g., mysql://user:pass@localhost/dbname
) -
Press Enter
to connect
Executing Queries
-
Press Ctrl+E
to open SQL editor -
Type query (syntax highlighting enabled) -
Press Ctrl+R
to execute -
Toggle between results/editor with /
Table Operations
Action | Shortcut | Description |
---|---|---|
Add Row | o |
Insert new record |
Edit Cell | c |
Modify selected content |
Delete Row | d |
Remove current record |
Save Changes | Ctrl+S |
Commit modifications |
Refresh Data | R |
Reload table content |
Apply Filter | / |
Enter WHERE conditions |
Remote Connection Example
[[database]]
Name = 'K8s Database'
Provider = 'postgres'
URL = 'postgres://user:pass@localhost:${port}/k8s_db'
Commands = [
{ Command = 'ssh -tt bastion -L 6443:localhost:6443', WaitForPort = '6443' },
{ Command = 'kubectl port-forward svc/postgres ${port}:5432', WaitForPort = '${port}' }
]
This configuration:
-
Establishes SSH tunnel to bastion host -
Configures Kubernetes port forwarding -
Automates dynamic port allocation via ${port}
Comprehensive Keybinding Reference
Global Shortcuts
Key | Action |
---|---|
q |
Quit application |
Ctrl+E |
Open SQL editor |
Backspace |
Return to connections |
? |
Show help |
Table Navigation
Key | Action |
---|---|
> |
Next page |
< |
Previous page |
K |
Sort ascending |
J |
Sort descending |
H |
Switch to tree view |
Ctrl+[ |
Previous tab |
Ctrl+] |
Next tab |
X |
Close active tab |
Tree View Controls
Key | Action |
---|---|
L |
Focus table panel |
G |
Jump to last node |
g |
Jump to first node |
Ctrl+U |
Scroll up 5 items |
Ctrl+D |
Scroll down 5 items |
Supported Database Systems
-
✅ MySQL -
✅ PostgreSQL -
✅ SQLite -
✅ MSSQL (SQL Server) -
🚧 MongoDB (in development)
Frequently Asked Questions
Who benefits most from LazySQL?
Ideal users include:
-
Terminal-centric developers -
DBAs managing heterogeneous environments -
Keyboard-focused power users -
Remote server administrators
How do I create tables?
While direct TUI table creation isn’t supported:
-
Press Ctrl+E
to open SQL editor -
Enter CREATE TABLE
statement -
Execute with Ctrl+R
-
Press R
to refresh schema view
How are data changes saved?
Explicit saving prevents accidental modifications:
-
After edits, press Ctrl+S
-
Verify changes in confirmation prompt -
Changes commit to database upon confirmation
What’s the SQLite connection syntax?
Use file-based paths:
file:database.sqlite
Or absolute paths:
/path/to/database.sqlite
Why use WaitForPort?
This ensures:
-
SSH tunnels establish completely -
Port forwards activate before connections -
Avoids premature connection attempts
Development Roadmap
Future enhancements include:
-
Expanded NoSQL database support -
Visual schema modification tools -
Customizable keybinding profiles -
Table relationship visualizations -
Query history management
Competitive Advantages
Feature Comparison
Feature | GUI Tools | SQL CLI | LazySQL |
---|---|---|---|
Launch Speed | Slow | Fast | Instant |
Resource Usage | High | Low | Minimal |
Learning Curve | Shallow | Steep | Gradual |
Cross-DB Support | Partial | Full | Unified |
Unique Benefits
-
Terminal Integration: Eliminates environment switching -
Keyboard Efficiency: Full operation without mouse -
Lightweight: Go-compiled with zero dependencies -
Extensible: Custom pre-connection commands -
Open Source: Community-driven MIT-licensed project
Conclusion: The Future of Terminal Database Management
LazySQL redefines database administration by:
-
Eliminating GUI tool bloat -
Simplifying complex SQL operations -
Unifying multi-database workflows
For developers, DBAs, and sysadmins, LazySQL delivers unprecedented terminal efficiency. Its philosophy remains simple: database management should be intuitive, keyboard-driven, and resource-efficient.
Project Repository: https://github.com/jorgerojas26/lazysql
Install today and transform your terminal database workflow.