Skip to content

usql

A single command-line client for many SQL and NoSQL databases, modeled on PostgreSQL's psql.

Stars
10.2k
Forks
409
Licence
MIT
Language
Go
Last update
4 days ago
Type
CLI

What it is

usql is a command-line program for connecting to and running queries against many different databases, including PostgreSQL, MySQL, Oracle, SQLite3 and Microsoft SQL Server. Its command set is modeled on PostgreSQL's psql, so people used to psql can work with other databases in a familiar way. It also adds features psql lacks, such as working with multiple databases and copying data between them.

  • Connect to a PostgreSQL, MySQL, or SQLite3 database and run SQL queries from the terminal
  • Run the official Docker image to open a SQLite file or a Postgres instance without a local install
  • Use backslash commands such as \drivers to list which database drivers a build supports
  • Copy data between databases using the copying feature described in the README

Great for

  • Developers who use several different databases and want one tool for all of them
  • Database administrators who already know psql and need to work with non-PostgreSQL databases
  • People who want to run quick queries against a local SQLite file from the terminal
  • Teams that connect to databases from Docker or containers

Not ideal for

  • Users who only need a graphical database browser; the README describes a command-line interface only
  • Users who need a database driver the build does not include, since the README says only base drivers are included by default and others need build tags
Step-by-step guide: how to use usqlInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Homebrew, the AUR helper yay, Go, or Docker, depending on the install route you choose

    Install with Homebrew

    brew install xo/xo/usql

    Install with Go (base drivers)

    go install github.com/xo/usql@latest

    Run the official Docker image

    docker run --rm -it docker.io/usql/usql:latest
  2. 2

    Run it

    • Install usql using one of the methods listed in the README
    • Run usql with a database URL, for example a sqlite3:// path or a postgres:// connection string as shown in the Docker examples
    • Type help once connected to see available commands
    • Type \q to quit
  3. 3

    Get the most out of it

    • Use the \drivers command to see which database drivers your build includes
    • Install with the most or all build tags if you need drivers beyond the base set, noting the README's warning about CGO and problematic drivers
    • Use the official Docker image to avoid local driver setup
    • Check the README's Database Support table for the URL scheme and aliases for each database

Downloads

Strengths

  • Works with many databases through one familiar, psql-style interface
  • Available through several install routes, including release downloads, Homebrew, Go, and Docker
  • Released under the MIT license and actively developed, per its repository metadata

Trade-offs

  • Only a base set of drivers is included by default; other databases need extra build tags or the most/all tags
  • The README is truncated here, so the full list of supported databases and features could not be verified from this excerpt

How it compares

ProjectStarsTypeLevelUpdatedBest for
usql (this)10.2kCLIbeginner4 days agoDevelopers who use several different databases and want one tool for all of them
sequelize30.3kLibraryintermediate5 days agoNode.js backend developers who use a relational SQL database
kysely14.3kLibraryintermediate4 days agoTypeScript developers who want SQL control without losing compile-time type checks
typeorm36.7kLibraryintermediate8 days agoNode.js or TypeScript developers building apps backed by a relational database
knex20.3kLibraryintermediate4 months agoNode.js developers who need to talk to a SQL database from application code
go-clean-arch10.2kLearning resourceintermediate2.5 years agoGo developers who want to see a concrete example of Clean Architecture

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.