usql
A psql-style command-line client that connects to PostgreSQL, MySQL, Oracle, SQLite3, SQL Server and many other SQL and NoSQL databases.
Tested on LinuxKnown vulnerabilities
Use it
Before you install: known vulnerabilities
pickfit found 1 known high or critical vulnerability in the packages a fresh install brings (OSV.dev, 16 Nov 2026). Weigh this before you install it.
go:github.com/andybalholm/brotli v1.2.4Excessive memory allocation when decompressing crafted streams in github.com/andybalholm/brotli (GO-2026-6888, critical, fixed in 1.2.7)
Linux x86_64
Download the v0.21.6 linux-amd64 release tarball, extract usql, and install it into ~/.local/bin
cd /tmp && curl -fsSLO https://github.com/xo/usql/releases/download/v0.21.6/usql-0.21.6-linux-amd64.tar.bz2 && mkdir -p /tmp/usqlx ~/.local/bin && python3 -c "import tarfile;t=tarfile.open('/tmp/usql-0.21.6-linux-amd64.tar.bz2');print(t.getnames());t.extractall('/tmp/usqlx')" && install -m755 /tmp/usqlx/usql ~/.local/bin/usql
Check that it works
usql --versionThe output should contain “usql 0.21.6”.
First thing to try
usql -c '\drivers'Run usql -c '\drivers' to list the database drivers your build supports.
What it does
- Query many SQL and NoSQL databasesTested
How to use it
- List the available drivers with
usql -c '\drivers'. - Run a SQL script against a database with
usql sq:<database file> -f <script.sql>. - Run a single query with
usql sq:<database file> -c '<your query>'.
- List the available drivers with
- Copy data between databasesTested
How to use it
- Copy query results from one database into a table in another with
usql -c "\copy csvq:<folder> sq:<database file> '<select query>' '<table>(<columns>)'". - Check the copied rows with
usql sq:<database file> -c '<your query>'.
- Copy query results from one database into a table in another with
- Use psql-style variables and backslash commandsTested
How to use it
- Write a script using commands such as
\set <name> <value>,\echo :<name>and\dt, and use:<name>inside queries. - Run it with
usql sq:<database file> -f <script.sql>.
- Write a script using commands such as
- Complete commands based on contextNot tested
How far pickfit got
Linux x86_64
- Installs
- Starts
- 3 of 4 features work
- Works offline
macOS and Windows: the project says it runs there; pickfit hasn’t tried it.
Good for
- connect to a PostgreSQL database from the terminal
- run a SQL script file against a database
- copy query results between different databases
An alternative to psql.
How pickfit tested it
Each run starts from a clean machine and follows the steps above. How pickfit verifies
Linux x86_64
Its main function works
- Replayed from scratch
- Works offline
- Checked on 15 Nov 2026
- Version usql 0.21.6
Differences the test machine hit
- README: Download a release for your platform and extract the usql file from the .tar.bz2
In the test: The Linux asset is usql-0.21.6-linux-amd64.tar.bz2 (there is also a usql_static build). I extracted it with Python's tarfile module, so I never checked whether this box has bzip2 for tar xjf.