The Problem
Working with multiple databases sucks. Every database has its own command-line client with different syntax, quirks, and annoyances. Switching between psql, mysql, sqlcmd, or whatever shell your NoSQL database uses is a productivity killer. Not to mention, half of these tools feel like they were built in the '90s and haven’t aged gracefully. If you’re juggling multiple databases, you need something better.
What This Does
usql is a universal command-line interface for working with SQL (and even some NoSQL) databases. Think of it as a psql-inspired shell that speaks almost every database dialect under the sun. The core functionality lives in the drivers/ directory, which houses over 100 files for handling connections to everything from PostgreSQL and MySQL to NoSQL options like Cassandra and Couchbase. If it has a driver, usql probably supports it.
The contrib/ folder is a playground of configuration files, scripts, and examples for setting up databases like Oracle, DB2, or MongoDB. This includes handy test SQL files (test.sql scattered around) and Docker configurations (podman-config for container fans). It’s not just a tool—it’s a Swiss Army knife for database tinkering.
Oh, and it’s written in Go. That means you can trust it to be fast, portable, and painful to debug (just kidding… mostly).
Real-World Use
Let’s say you’re a developer managing data migrations between a PostgreSQL database and a MySQL database. Instead of running two separate clients, you could use usql to connect to both databases in the same session. Here’s an example workflow:
It’s intuitive, compact, and supports features like syntax highlighting, query history, and backslash commands (\c, \copy, etc.) just like psql.
The Bottom Line
usql is awesome if you work with multiple databases and are tired of juggling inconsistent CLI tools. It's perfect for DBAs, backend developers, or anyone who’s ever Googled "how to export MySQL to CSV." That said, it’s overkill for small projects where you only use one database. If you’re living in PostgreSQL land, just stick with psql. But if you're a database polyglot? usql is your new best friend.