MySQL Client and Connection Cheatsheet/Use batch mode for parsable output

Reduce formatting for machine-friendly results.

Section: script-friendly client patterns

Use batch mode for parsable output

bash
bash
mysql -u app_user -p -B -e "SELECT NOW();"
Explanation

`-B` outputs tab-separated rows that are easier to parse in shell tools.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing script-friendly client patterns
Query without column headers
Print raw rows for scripts and pipelines.
OpenIn sheetbashsame section
Log an interactive session to a file
Write statements and output to a transcript file.
OpenIn sheetsqlsame section
Show connection status in the mysql client
Display host, connection id, server version, and current database.
OpenIn sheetsqlsame section
Show active sessions
Inspect current client connections and statements.
OpenIn sheetsqlsame section
Kill a running connection
Terminate a session by connection id.
OpenIn sheetsqlsame section
Run one query and exit
Execute a SQL statement non-interactively.
OpenIn sheetbash2 tag match