Introduction
LazySQL is a terminal-based database management tool written in Go that provides a keyboard-driven interface for browsing tables, running queries, and editing data. It follows the design philosophy of lazygit and lazydocker, bringing the same TUI experience to database management.
What LazySQL Does
- Connects to MySQL, PostgreSQL, SQLite, and MSSQL databases from a single TUI
- Browses database schemas, tables, and records with keyboard navigation
- Executes SQL queries with syntax highlighting and result display
- Supports inline editing, inserting, and deleting records directly in the table view
- Manages multiple database connections in tabbed views
Architecture Overview
LazySQL uses the bubbletea TUI framework for rendering and event handling. Database connections are managed through standard Go database drivers (go-sql-driver for MySQL, lib/pq for PostgreSQL, go-sqlite3, and go-mssqldb). The application maintains a connection pool and renders query results in scrollable table widgets. Schema introspection queries are database-specific and abstracted behind a common interface.
Self-Hosting & Configuration
- Install via
go install, Homebrew, or download prebuilt binaries for Linux, macOS, and Windows - Pass a database connection URL as a command-line argument to connect immediately
- Save frequently used connections in
~/.config/lazysql/config.toml - Configure keybindings and display options in the same config file
- Supports SSH tunnel connections for accessing remote databases securely
Key Features
- Unified interface for MySQL, PostgreSQL, SQLite, and MSSQL in one tool
- Keyboard-driven design inspired by lazygit for fast navigation without a mouse
- Inline record editing lets you modify data directly in the table view
- SQL editor with syntax highlighting for running custom queries
- Cross-platform with prebuilt binaries for Linux, macOS, and Windows
Comparison with Similar Tools
- DBeaver — Full-featured GUI database client; LazySQL is lightweight and terminal-native
- pgcli/mycli — CLI clients with auto-completion; LazySQL adds a visual table browser
- DataGrip — JetBrains IDE for databases; LazySQL is free and runs in any terminal
- Beekeeper Studio — GUI database manager; LazySQL fits into terminal-centric workflows
- usql — Universal CLI for SQL databases; LazySQL provides a richer TUI experience
FAQ
Q: Does it support NoSQL databases? A: Currently LazySQL supports relational databases (MySQL, PostgreSQL, SQLite, MSSQL). NoSQL support is not available.
Q: Can I edit data directly in the table view? A: Yes. Navigate to a cell, press Enter to edit, and the change is applied to the database.
Q: Does it work over SSH? A: Yes. LazySQL supports SSH tunnel connections and also works natively when run on a remote server via SSH.
Q: How does it compare to pgcli or mycli? A: pgcli and mycli provide enhanced CLI query experiences. LazySQL adds a visual table browser and schema navigator on top of query execution.