19 Free Terminal SQL Client for Linux, Windows and macOS
What is an SQL Client?
An SQL client is a software tool that allows users to connect to and interact with a database server using SQL (Structured Query Language). It provides an interface to execute SQL queries, manage database structures, and perform administrative tasks such as backups, updates, and migrations.
Benefits of Using SQL Clients
SQL clients simplify database management by providing an intuitive way to write and execute queries. They offer features like syntax highlighting, query formatting, and database schema visualization, which enhance productivity and reduce errors.
Additionally, many SQL clients support multiple databases, making it easier to manage different systems from a single interface.
Who Uses SQL Clients?
SQL clients are used by a wide range of professionals, including database administrators (DBAs), developers, data analysts, and anyone who needs to interact with databases regularly.
Whether you're building applications, analyzing data, or maintaining databases, an SQL client is an essential tool that streamlines your workflow and improves efficiency.
In the following list, you will find the best open-source free terminal-based SQL clients.
1- Harlequin
Harlequin is a free terminal-based SQL client that is written completely with Python. It also can work with DuckDB.
Features
- Fancy user interface
- Keyboard support
- Supports Files and S3 Objects
- Query editor
- Results viewer
- Full-screen support
- Database browser
- Results Export
- Query history
- Theme support
- Supports SQLite, MySQL, DuckDB, PostgreSQL, Databricks, Wherebots, Cassandra, and BigQuery.
- Supports local files
Install Harlequin
After installing Python 3.8 or above, install Harlequin using pip
or pipx
with:
pipx install harlequin
2- usql
usql
is a universal command-line interface for PostgreSQL, MySQL, Oracle Database, SQLite 3, Microsoft SQL Server, and many other databases including NoSQL and non-relational databases!
usql
provides a simple way to work with SQL and NoSQL databases via a command-line inspired by PostgreSQL's psql
. usql
supports most of the core psql
features, such as variables, backticks, backslash commands and has additional features that psql
does not, such as multiple database support, copying between databases, syntax highlighting, context-based completion, and terminal graphics.
Database administrators and developers that would prefer to work with a tool like psql
with non-PostgreSQL databases, will find usql
intuitive, easy-to-use, and a great replacement for the command-line clients/tools for other databases.
usql works on macOS, Windows and Linux. It can be also installed using Docker.
3- mssql-cli
mssql-cli is an interactive command line query tool for SQL Server. This open source tool works cross-platform and proud to be a part of the dbcli community.
Features
- Auto-completion: fewer keystrokes needed to complete complicated queries.
- Syntax highlighting: highlights T-SQL keywords.
- Query history: easily complete an auto-suggested query that was previously executed.
- Configuration file support: customize the mssql-cli experience for your needs.
- Multi-line queries: execute multiple queries at once using the multi-line edit mode.
- Non-interactive support: execute a query without jumping into the interactive experience.
4- dblab
dblab is a fast and lightweight interactive terminal based UI application for PostgreSQL, MySQL and SQLite3, written in Go and works on OSX, Linux and Windows machines.
Main idea behind using Go for backend development is to utilize ability of the compiler to produce zero-dependency binaries for multiple platforms.
dblab was created as an attempt to build very simple and portable application to work with local or remote PostgreSQL/ MySQL/ SQLite3/ Oracle/ SQL Server databases.
Features
- Cross-platform support OSX/ Linux/ Windows 32/64-bit
- Simple installation (distributed as a single binary)
- Zero dependencies.
5- mycli
A command line client for MySQL that can do auto-completion and syntax highlighting.
6- trdsql
trdsql is a CLI tool that can execute SQL queries on CSV, LTSV, JSON, YAML and TBLN files.
This tool is similar to others such as q and textql, with a key distinction: it allows the use of PostgreSQL or MySQL syntax.
7- pgcli
This is a free and open-source Postgres CLI with autocompletion and syntax highlighting.
8- SQLine
Command line tool to perform SQL database queries. With sqline
you can mix the power of Unix tools with the power of SQL.
9- sqlcli
A command line interface (CLI) for interacting with SQLModel.
Features
- Read data using the
sqlcli select
command. - Insert data using the
sqlcli insert
command. - Interactive console powered by typer, rich, and sqlmodel.
- Pretty terminal outputs generated by rich.
- Multiple output formats including rich, json, and python dictionaries.
10- easyaccess
easyaccess
is an enhanced command line interpreter and Python package created to facilitate access to astronomical catalogs stored in SQL Databases.
It provides a custom interface with custom commands and was specifically designed to access data from the Dark Energy Survey Oracle database, including autocompletion of tables, columns, users and commands, simple ways to upload and download tables using csv, fits and HDF5 formats, iterators, search and description of tables among others.
It can easily be extended to another surveys or SQL databases.
The package was completely written in Python and support customized addition of commands and functionalities.
11- litecli
A command-line client for SQLite databases that has auto-completion and syntax highlighting.
12- lazysql
This is a free azygit inspired terminal sql client.
13- Remal SQL SQL-Runner
The SQL-Runner
is a small command-line tool written in Java and can be used on all platforms where Java is available. The tool can be used to execute any SQL commands, especially it is suitable for executing SQL SELECT
, UPDATE
, DELETE
, and CREATE
commands.
You can use this tool for example to create a new database schema during the application deployment and insert initial data into databases. The tool uses a JDBC driver to connect to a specific database and relatively easy to configure.
The latest version of the tool only supports Oracle Database server, but other SQL dialects can easily be added.
17- sql-cli
Universal command-line interface for SQL databases. Built on top of Knex. Supports connecting over SSH.
18- termtable
termtable is a go based terminal database client made using bubbletea
19- SQL-Bless
The SQL-Bless is a command-line database client like SQL*Plus or psql.
Features
- Emacs-like keybindings for inline editing of multiple lines of SQL.
- The action of
Enter
key will only insert a line feed code. - Press
Ctrl-J
orCtrl
-Enter
to execute the input.
- The action of
- Save the result of SELECT in CSV format
- Supported RDBMS
- SQLite3
- Oracle
- PostgreSQL
- Microsoft SQL Server
- MySQL
- Allows editing database records directly, similar to a spreadsheet (with the
EDIT
command)