MySQL Shell 8.0  /  Customizing MySQL Shell  /  Customizing the Prompt

13.3 Customizing the Prompt

The prompt of MySQL Shell can be customized using prompt theme files. To customize the prompt theme file, either set the MYSQLSH_PROMPT_THEME environment variable to a prompt theme file name, or copy a theme file to the ~/.mysqlsh/prompt.json directory on Linux and Mac, or the %AppData%\MySQL\mysqlsh\prompt.json directory on Windows.

The user configuration path for the directory can be overridden on all platforms by defining the environment variable MYSQLSH_USER_CONFIG_HOME. The value of this variable replaces %AppData%\MySQL\mysqlsh\ on Windows or ~/.mysqlsh/ on Unix.

The format of the prompt theme file is described in the README.prompt file, and some sample prompt theme files are included. On startup, if an error is found in the prompt theme file, an error message is printed and a default prompt theme is used. Some of the sample prompt theme files require a special font (for example SourceCodePro+Powerline+Awesome+Regular.ttf). If you set the MYSQLSH_PROMPT_THEME environment variable to an empty value, MySQL Shell uses a minimal prompt with no color.

Color display depends on the support available from the terminal. Most terminals support 256 colors in Linux and Mac. In Windows, color support requires either a 3rd party terminal program with support for ANSI/VT100 escapes, or Windows 10. By default, MySQL Shell attempts to detect the terminal type and handle colors appropriately. If auto-detection does not work for your terminal type, or if you want to modify the color mode due to accessibility requirements or for other purposes, you can define the environment variable MYSQLSH_TERM_COLOR_MODE to force MySQL Shell to use a specific color mode. The possible values for this environment variable are rgb, 256, 16, and nocolor.