Apps ·
Browse and query your database from the panel
Use the database console on every PostgreSQL, MariaDB, MySQL and Redis app, and on apps with a bundled database: browse tables, run SQL, inspect Redis keys, and know its limits.
Every database you run with us has a console in the panel: browse tables and rows, run SQL, and for Redis browse keys and send commands. Nothing to install, no port to open, no client to configure. This guide shows where it is, what it can do and where its limits are.
Where to find it
Open the app under Apps in the panel. The card Database console appears once the app is running, for:
- the database products themselves: PostgreSQL, MariaDB, MySQL and Redis;
- apps that ship with their own database: WordPress, Ghost, Nextcloud, Gitea, Mattermost, Mealie, Umami, Miniflux, Matomo, Paperless-ngx, Wiki.js, Vikunja and FreshRSS. For those the console opens the bundled database, the one the app itself uses.
The badge in the card header names the engine and the database it opened. MySQL shows all schemas because a fresh MySQL server has no database of its own until you create one.
Browsing tables
The Tables tab lists every table with an estimated row count. Click one to see its first 50 rows, with the column name and type in the header. Use the arrows below the grid to page through larger tables.
Values are shown as the database returns them; NULL is marked as such. Long values are cut off in the grid; hover a cell to see the whole thing.
Running SQL
Switch to the SQL tab, type a statement and click Run or press Ctrl+Enter (Cmd+Enter on a Mac).
- A query that reads (
SELECT,SHOW,EXPLAIN,WITHand so on) comes back as a grid. Up to 5,000 rows are shown; add aLIMITfor anything bigger. - Anything else runs as written and shows the engine's own status line, such as
UPDATE 3orQuery OK, 1 row affected. - Errors come back exactly as the database reports them, with the line number where it stopped.
- A run is cut off after 20 seconds and after 2 MB of output.
Each run is its own session, so a BEGIN in one run does not carry over to the next; put a whole transaction into one run. On MySQL and MariaDB statements commit immediately, as they would in any client with autocommit on.
The text you typed stays in the box while the page is open, so you can refine a query without retyping it.
Redis
For Redis the card has Keys and Commands instead.
- Keys lists keys matching a pattern,
*by default. Narrow it with the usual Redis globbing, for examplesession:*, and click Search. Each key shows its type and time to live; Load more fetches the next batch. - Click a key to see its contents: strings as text, hashes and sorted sets as field and value pairs, lists and sets as items. Large values are shown in part, and the card says so.
- Commands runs anything redis-cli would, one command per line:
HGETALL user:1,TTL session:abc,DEL cache:*. Replies are shown as text; a wrong command or type shows the Redis error.
Who runs the queries
The console connects from inside your database's own container, as the engine's administrative user: postgres on PostgreSQL, root on MariaDB, moco-writable on MySQL, and with the instance password on Redis. That means it can do anything, including dropping a table. There is no confirmation step and no undo; take a backup before a change you are not sure about (see Back up and restore your app).
Every run is recorded in your account's activity log with the first part of the statement, so you can see later who ran what.
When to use a real client instead
The console is for looking things up, fixing a row, running a migration script by hand. For anything heavier connect with your own tools using the details in the Database Connection card: pg_dump and psql, mysqldump and the mariadb client, redis-cli. Loading a large dump, long-running analytical queries and anything that needs a transaction across several runs belong there.
Anything you can do in the console you can also do from the command line with headpat apps db query <app-id> "<sql>"; see Automate the panel with API keys and the CLI.