brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: mariadb --auto-vertical-output switches wide results to one field per line

Mariadb
~/tips/tip-database-mariadb-auto-vertical-output

mariadb --auto-vertical-output -u root -p appdb

Makes the MariaDB client print wide query results vertically, one column per line.

A SELECT * on a wide table in the MariaDB client wraps around the terminal until it is unreadable. Ending a statement with \G fixes one query, but I would rather not decide that for every query.

mariadb --auto-vertical-output -u root -p appdb

Wide tables are what annoy me most in the MariaDB client. The docs say this option automatically switches to vertical output mode when a result is wider than the terminal. Narrow results stay in the normal table, wide ones print one field per line, roughly like this:

*************************** 1. row ***************************
        id: 1
     email: [email protected]
 created_at: 2026-01-12 09:30:00

If you always want vertical output, -E / --vertical does that for all queries. And for a single statement the docs say you end it with \G instead of a semicolon.

SELECT * FROM users WHERE id = 1\G

I like it as the habit for exploring a database by hand: I open the client once and stop worrying about the shape of each query. Since the switch depends on how wide a result is compared with your terminal, it is a setting for interactive use, and that is the caveat. For scripts, use --batch (-B), which prints tab-separated rows with no table drawing.

Further reading: MariaDB documentation: mariadb command-line client

More Mariadb tips ALTER TABLE t ADD COLUMN z INT INVISIBLE; CREATE SEQUENCE s START WITH 100 INCREMENT BY 10; CREATE OR REPLACE TABLE scratch ( mariadb --init-command="SET SESSION sql_mode='STRICT_ALL_TABLES'" mydb mariadb-admin -u root -p extended-status --relative --sleep=10 \ All Mariadb tips (15) All topics

Link