Universal command-line interface for SQL and NoSQL databases with psql-like syntax and multi-database support
usql is a universal command-line database client that provides a psql-inspired interface for connecting to multiple database types. It supports PostgreSQL, MySQL, Oracle, SQLite3, Microsoft SQL Server, and many other SQL and NoSQL databases through a single unified command-line tool.
The tool implements most core psql features including variables, backticks, and backslash commands, while adding capabilities that psql lacks. These include multi-database support within a single session, copying data between different database types, syntax highlighting, context-based completion, and terminal graphics output. Database administrators can work with non-PostgreSQL databases using familiar psql syntax and workflows.
usql is built with Go and uses a modular driver system where different database drivers can be included or excluded at build time using build tags. The base build includes drivers for PostgreSQL, MySQL, SQLite3, Microsoft SQL Server, Oracle, and CSVQ, while additional drivers can be enabled with tags like 'most' or 'all'. The tool supports connection strings through the dburl library and can display available drivers with the \drivers command.
# via Homebrew
brew install xo/xo/usql
# via Go
go install github.com/xo/usql@latest
# via Docker
docker run --rm -it docker.io/usql/usql:latest