Commands

Introduction

Mycli sends most input you enter directly to the MySQL server as a SQL statement. There is also a set of commands that mycli itself will accept locally. To see these commands, type /help or /? at the prompt:

mycli> /help
┌─────────────────┬────────┬──────────────────────────────┬──────────────────────────────────────────────────┐
│ Command         │ Alias  │ Usage                        │ Description                                      │
├─────────────────┼────────┼──────────────────────────────┼──────────────────────────────────────────────────┤
│ /bug            │ <null> │ /bug                         │ File bug on GitHub.                              │
│ /clip           │ <null> │ /clip | <query>\clip         │ Copy query to system clipboard.                  │
│ /config         │ <null> │ /config <command> [key]      │ Inspect config file settings (/config help).     │
│ /connect        │ /r     │ /connect [database]          │ Reconnect to server, optionally switching dbs.   │
│ /delimiter      │ <null> │ /delimiter <string>          │ Set end-of-statement delimiter.                  │
│ /dsn            │ <null> │ /dsn <command>               │ Manage saved DSNs (/dsn help).                   │
│ /dt             │ <null> │ /dt[+] [table]               │ List or describe tables.                         │
│ /edit           │ /e     │ /edit <file> | <query>\edit  │ Edit query with editor (via $VISUAL/$EDITOR).    │
│ /exit           │ /q     │ /exit                        │ Exit.                                            │
│ /f              │ <null> │ /f [name [args] [--key=val]] │ Run favorite query shortcut.                     │
│ /favorite       │ <null> │ /favorite <command>          │ Manage favorite queries (/favorite help).        │
│ /fd             │ <null> │ /fd <name>                   │ Delete favorite query shortcut.                  │
│ /fs             │ <null> │ /fs <name> <query>           │ Save favorite query shortcut.                    │
│ \g              │ <null> │ <query>\g                    │ Display results (mnemonic: go).                  │
│ \G              │ <null> │ <query>\G                    │ Display results vertically.                      │
│ /help           │ /?     │ /help [term]                 │ Show this table, or search for help on term.     │
│ /l              │ <null> │ /l                           │ List databases.                                  │
│ /llm            │ /ai    │ /llm [arguments]             │ Interrogate LLM (/llm help).                     │
│ /nopager        │ /n     │ /nopager                     │ Disable pager; print to stdout.                  │
│ /notee          │ <null> │ /notee                       │ Stop writing all results to tee file.            │
│ /nowarnings     │ /w     │ /nowarnings                  │ Disable automatic warnings display.              │
│ /once           │ /o     │ /once [-o] <file>            │ Append next result to a file (-o to overwrite).  │
│ /pager          │ /P     │ /pager [command]             │ Set pager to [command]; print results via pager. │
│ /ping           │ <null> │ /ping                        │ Check connection.                                │
│ /pipe_once      │ /|     │ /pipe_once <command>         │ Send next result to subprocess.                  │
│ /prompt         │ /R     │ /prompt [string]             │ Set or show prompt format.                       │
│ /quit           │ /q     │ /quit                        │ Quit.                                            │
│ /redirectformat │ /Tr    │ /redirectformat <format>     │ Set table format used for redirected results.    │
│ /rehash         │ /#     │ /rehash                      │ Refresh completions.                             │
│ /source         │ /.     │ /source [options] <file>     │ Execute queries from file.                       │
│ /status         │ /s     │ /status                      │ Get status information from server.              │
│ /system         │ <null> │ /system [-r] <command>       │ Execute shell command (-r for raw mode).         │
│ /tableformat    │ /T     │ /tableformat <format>        │ Set table format used for interactive results.   │
│ /tee            │ <null> │ /tee [-o] <file>             │ Append all results to file (-o to overwrite).    │
│ /timing         │ /t     │ /timing                      │ Toggle query timing.                             │
│ /use            │ /u     │ /use <database>              │ Change to a new database.                        │
│ /warnings       │ /W     │ /warnings                    │ Enable automatic warnings display.               │
│ /watch          │ <null> │ /watch [sec] [-c] <query>    │ Execute query every [sec] seconds (default 5).   │
│ \x              │ <null> │ <query>\x                    │ Display results in an interactive explorer.      │
└─────────────────┴────────┴──────────────────────────────┴──────────────────────────────────────────────────┘
Use \backslash forms when at end-of-line.
Docs index — https://mycli.net/docs

Most commands have a long and short form. Many of the commands starting with backslash are case sensitive. Most command lines may be followed by an optional semicolon.

Sponsors

Nova Kid School

blogroll

social