Configuration
Introduction
Mycli's user settings are configured via the file located at ~/.myclirc,
which is a hidden file in your home folder on Linux and macOS. On Windows
the file is located at C:\Users\<username>\.myclirc.
The config file is created when mycli is launched for the very first time. Updates to the file are not overwritten by subsequent launches of mycli or when updating the version of mycli. (See "Checkup" below).
Mycli supports a few methods of storing user credentials. See the connection configuration documentation for more information.
Checkup
Mycli also inherits configuration from the package defaults, which will be
taken for any settings not present in ~/.myclirc. If you want to see new
available settings which are being inherited from the package defaults, run
$ mycli --checkup
There could be a substantial number of settings not present in your
~/.myclirc because of the fact that the user's configuration is not
overwritten or updated during upgrades.
XDG Layout
Those who prefer the XDG config file layout may move ~/.myclirc to
~/.config/mycli/myclirc where it will also be read.
From the REPL
The configuration which governs the current session can be inspected
from the REPL using the /config command. Example:
/config search pager
See /config help for more.
Latest Config File
The latest version of the package defaults settings file can always be found at
- https://github.com/dbcli/mycli/blob/main/mycli/myclirc
though note that that the repository content may reflect recent development which is ahead of released features.
Sample Config File
[main]
# Enable or disable the automatic displaying of warnings ("SHOW WARNINGS")
# after executing a SQL statement when applicable.
show_warnings = False
# Enables context sensitive auto-completion. If this is disabled then all
# possible completions will be listed.
smart_completion = True
# Methods to find completion candidates, in priority order. Empty means the
# default list. Filename matching requires perfect and/or slash_words to be
# listed. Polars completions uses its own methods.
# * perfect - exact leading match
# * regex - ordered charater match with limited intervening spans ("rgx" matches "regex")
# * under_words - like regex but follows underscores ("uw" matches "under_words")
# * slash_words - like regex but follows slahes ("sw" matches "slash/words")
# * camel_case - like regex but follows capitalization ("cc" matches "CamelCase")
# * rapidfuzz - true approximate matching, _ie_ autcorrect
completion_match_order = perfect, regex, under_words, slash_words, camel_case, rapidfuzz
# Break completion candiate sorting ties by
# * frecency - history frequency combined with recency, the default
# * length - shortest first
# * lexicographic - alphabetical, ignoring case
completion_tiebreaker = frecency
# Maximum intervening span length between input characters for regex completion
# candidate matches. Empty uses the default of 3. Higher is more liberal, but
# carries a perforance penalty.
regex_match_distance = 3
# Minimum input characters before using rapidfuzz approximate matching.
# Empty uses the default of 4. Set to 0 or less to remove the minimum.
rapidfuzz_min_length = 4
# Minimum rapidfuzz candidate length as a fraction of the input length.
# Empty uses 0.67. Lower is more liberal. Set to 0 or less to suppress
# the length filter.
rapidfuzz_length_coverage = 0.67
# Minimum rapidfuzz similarity score (0-100). Lower is more liberal.
# Empty uses the default of 75.
rapidfuzz_score_cutoff = 75
# Text appended to indexed column names in the completion menu. This text is
# not inserted into the query. Leave empty to disable the marker. Quote values
# containing spaces, commas, or comment characters.
# Alternative: ' [indexed]'
indexed_column_suffix = *
# Minimum characters typed before offering completion suggestions. Forward
# slash for a command is an exception which always offers completions.
# Suggestion: 3.
min_completion_trigger = 1
# Prefetch completion metadata for schemas in the background after launch.
# Possible values:
# always = prefetch all schemas (default)
# never = do not prefetch any schemas
# listed = prefetch only the schemas named in prefetch_schemas_list
prefetch_schemas_mode = always
# Comma-separated list of schemas to prefetch when
# prefetch_schemas_mode = listed. Ignored in other modes.
prefetch_schemas_list =
# Expand whole DSN alias values in the form ${VAR} from the environment.
expand_dsn_alias_env_vars = False
# Multi-line mode allows breaking up the sql statements into multiple lines. If
# this is set to True, then the end of the statements must have a semi-colon.
# If this is set to False then sql statements can't be split into multiple
# lines. End of line (Return) is considered as the end of the statement.
# When True, saving a favorite query requires pressing Return twice.
multi_line = False
# Destructive warning mode will alert you before executing a sql statement
# that may cause harm to the database such as "drop table", "drop database"
# or "shutdown".
destructive_warning = True
# Queries starting with these keywords will activate the destructive warning.
# UPDATE will not activate the warning if the statement includes a WHERE
# clause.
destructive_keywords = DROP SHUTDOWN DELETE TRUNCATE ALTER UPDATE
# interactive query history location.
history_file = ~/.mycli-history
# Number of recent history entries used to calculate frecency. Set to 0 or
# leave empty to disable frecency calculation entirely.
frecency_history_entries = 1000
# Number of REPL entries between frecency recalculation. Set to 0 to disable
# periodic recalculation.
frecency_refresh_interval = 50
# log_file location.
log_file = ~/.mycli.log
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG". "NONE" disables logging.
log_level = INFO
# Log every query and its results to a file. Enable this by uncommenting the
# line below.
# audit_log = ~/.mycli-audit.log
# Timing of SQL statements and table rendering, or LLM commands.
timing = True
# Seconds between query state and elapsed time updates, off if zero. Disabling
# this saves a second connection to the server. If set to a very low positive
# value, would lead to excessive SHOW PROCESSLIST queries. 0.5 is probably a
# good lower bound.
show_query_state_interval = 0.5
# Show the full SQL when running a favorite query. Set to False to hide.
show_favorite_query = True
# Load additional favorite queries from the [favorite_queries] section of this
# file. Favorites in the user's configuration file take precedence over the
# shared file. The path must be absolute after expanding ~.
# Example: /usr/local/etc/mycli/shared-favorites.ini
shared_favorites_file =
# Load additional DSN aliases from the [alias_dsn] section of this file. DSN
# aliases in the user's configuration file take precedence over the shared
# file. The path must be absolute after expanding ~.
# Example: /usr/local/etc/mycli/shared-dsns.ini
shared_dsns_file =
# Beep after long-running queries are completed; 0 to disable.
beep_after_seconds = 0
# Table format. Possible values: ascii, ascii_escaped, csv, csv-noheader,
# csv-tab, csv-tab-noheader, double, fancy_grid, github, grid, html, jira,
# jsonl, jsonl_escaped, latex, latex_booktabs, mediawiki, minimal, moinmoin,
# mysql, mysql_unicode, mysql_heavy, orgtbl, pipe, plain, psql, psql_unicode,
# rst, simple, sql-insert, sql-update, sql-update-1, sql-update-2, textile,
# tsv, tsv_noheader, vertical.
# Recommended: mysql_unicode.
table_format = mysql_unicode
# Redirected otuput format
# Recommended: csv.
redirect_format = csv
# How to display the missing value (ie NULL). Only certain table formats
# support configuring the missing value. CSV for example always uses the
# empty string, and JSON formats use native nulls.
null_string = <null>
# How to align numeric data in tabular output: right or left.
numeric_alignment = right
# How to display binary values in tabular output: "hex", or "utf8". "utf8"
# means attempt to render valid UTF-8 sequences as strings, then fall back
# to hex rendering if not possible.
binary_display = hex
# A command to run after a successful Parquet save with ".>" or shell output
# redirect with "$>". The sequence "{}" will be replaced by the escaped
# destination filename. Mac example: echo {} | pbcopy.
# Escaping is not reliable/safe on Windows.
post_redirect_command =
# Syntax coloring style. Possible values (many support the "-dark" suffix):
# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs,
# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default,
# fruity.
# Screenshots at https://mycli.net/syntax
# Can be further modified in [colors]
syntax_style = default
# Keybindings: Possible values: emacs, vi.
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
key_bindings = emacs
# Enabling this option will show the suggestions in a wider menu. Thus more items are suggested.
wider_completion_menu = False
# MySQL prompt
# * \D - full current date, e.g. Sat Feb 14 15:55:48 2026
# * \R - current hour in 24-hour time (00–23)
# * \r - current hour in 12-hour time (01–12)
# * \m - minutes of the current time
# * \s - seconds of the current time
# * \P - AM/PM
# * \d - selected database/schema
# * \e - current edit mode (emacs or vi)
# * \h - hostname of the server
# * \H - shortened hostname of the server
# * \p - connection port
# * \j - connection socket basename
# * \J - full connection socket path
# * \k - connection socket basename OR the port
# * \K - full connection socket path OR the port
# * \T - connection SSL/TLS version
# * \t - database vendor (Percona, MySQL, MariaDB, TiDB, Doris)
# * \u - username
# * \w - number of warnings, or "(none)" (requires frequent trips to the server)
# * \W - number of warnings, or the empty string (requires frequent trips to the server)
# * \y - uptime in seconds (requires frequent trips to the server)
# * \Y - uptime in words (requires frequent trips to the server)
# * \b - "[TX]" when in a transaction, otherwise empty (requires frequent trips to the server)
# * \A - DSN alias
# * \n - a newline
# * \_ - a space
# * \\ - a literal backslash
# * \x1b[...m - an ANSI escape sequence (can style with color or attributes)
# ANSI color example: prompt = '\x1b[31mroot\x1b[0m@localhost:\d> '
# * \<html> - a leading sequence indicating that the rest of the prompt be styled like HTML.
# See https://python-prompt-toolkit.readthedocs.io/en/stable/pages/printing_text.html#html .
# Characters such as "&" or literal "<" and ">" must be HTML-escaped in this mode.
# HTML styles cannot be combined with ANSI sequences. HTML mode takes precedence.
# HTML color example: prompt = '\<html><red><u>root</u></red>@localhost:\d> '
#
prompt = '\t \u@\h:\d> '
prompt_continuation = '->'
# Use the same prompt format strings to construct a status line in the toolbar,
# where \B in the first position refers to the default toolbar showing keystrokes
# and state. Example:
#
# toolbar = '\B\d \D'
#
# If \B is included, the additional content will begin on the next line. More
# lines can be added with \n. If \B is not included, the customized toolbar
# can be a single line. An empty value is the same as the default "\B". The
# special literal value "None" will suppress the toolbar from appearing.
toolbar = ''
# Use the same prompt format strings to construct a terminal tab title.
# The original XTerm docs call this title the "window title", but it now
# probably refers to a terminal tab. This title is only updated as frequently
# as the database is changed.
terminal_tab_title = ''
# Use the same prompt format strings to construct a terminal window title.
# The original XTerm docs call this title the "icon title", but it now
# probably refers to a terminal window which contains tabs. This title is
# only updated as frequently as the database is changed.
terminal_window_title = ''
# Use the same prompt format strings to construct a window title in a terminal
# multiplexer. Currently only tmux is supported. This title is only updated
# as frequently as the database is changed.
multiplex_window_title = ''
# Use the same prompt format strings to construct a pane title in a terminal
# multiplexer. Currently only tmux is supported. This title is only updated
# as frequently as the database is changed.
multiplex_pane_title = ''
# Skip intro info on startup and outro info on exit, and generally reduce
# feedback. This is equivalent to giving --quiet at the command line.
less_chatty = False
# Use alias from --login-path instead of host name in prompt
login_path_as_host = False
# Cause result sets to be displayed vertically if they are too wide for the current window,
# and using normal tabular format otherwise. (This applies to statements terminated by ; or \G.)
auto_vertical_output = False
# keyword casing preference. Possible values "lower", "upper", "auto"
keyword_casing = auto
# disabled pager on startup
enable_pager = True
# Choose a specific pager
pager = 'less'
# Comma-separated sources to respect for a password, in order of precedence.
# Valid choices:
# * prompt # plain trailing --password at the CLI
# * literal # --password=<literal> at the CLI
# * file # --password-file=<file> at the CLI
# * environment # $MYSQL_PWD environment variable
# * dsn # mysql://user:password@ field in a DSN
# * boundary # value provided by Boundary client
# * vault # value retrieved from "vault kv get"
# * login_path # --login-path=<path> at the CLI
# * keyring # value retrieved from system keyring
# * fallback # interactive prompt after a passwordless connection fails
# If "fallback" is given, it must come last.
password_sources = prompt, literal, file, environment, dsn, boundary, vault, login_path, keyring, fallback
# Whether to store and retrieve passwords from the system keyring.
# * False - never use keyring
# * True - always use keyring
# * auto - use keyring unless currently in an SSH connection
# See the documentation for https://pypi.org/project/keyring/ for your OS.
# Note that the hostname is considered to be different if short or qualified.
# This can be overridden with --use-keyring= at the CLI.
# A password can be reset with --use-keyring=reset at the CLI.
# Recommended: auto
use_keyring = False
# Comma-separated password sources eligible to be saved in the keyring.
# Valid choices: same as password_sources (above).
# use_keyring must be True or auto.
keyring_sources = prompt, literal, file, environment, dsn, login_path, fallback
[editor]
# Command line to invoke for /edit, instead of respecting the $VISUAL/$EDITOR
# environment variables. Suggestions:
# * VS Code: code --wait
# * Vim: vim
# * Emacs: emacsclient
# For emacsclient, first start the server with "M-x server-start".
editor_command =
[explorer]
# Command to invoke for output of queries ending in \x, instead of the pager.
# The command should accept query results on the standard input.
# Suggestions:
# * fzf --no-height --header-lines=3 --layout=reverse (good with tabular output formats)
# * csvlens (good with format csv)
# * jless (good with format jsonl)
explorer_command = fzf --no-height --header-lines=3 --layout=reverse
# Format to emit output for queries ending in \x.
# Suggestions: see explorer_command above.
format = mysql_unicode
# Whether to remove the last line from the formatted output.
trim_footer = False
[dataframe]
# How to display inline image results in a terminal emulator. Possible values:
# * kitty
# * iterm2
# empty to disable
image_protocol = kitty
# PNG plot resolution in pixels per inch. Must be a positive integer.
# The apparent size is a combination of plot_ppi and plot_scale_factor.
plot_ppi = 200
# PNG plot resolution multiplier. Must be a positive number.
# The apparent size is a combination of plot_ppi and plot_scale_factor.
plot_scale_factor = 1.0
# Altair theme for rendering plots. Examples: carbong90, dark, default.
# Available themes depend on the installed libraries. See
# https://github.com/vega/vega-themes/#included-themes
plot_theme = carbong90
[search]
# Whether to apply syntax highlighting to the preview window in fuzzy history
# search. There is a small performance penalty to enabling this. The "pygmentize"
# CLI tool must also be available. The syntax style from the "syntax_style"
# option will be respected, though additional customizations from [colors] will
# not be applied.
highlight_preview = False
[connection]
# character set for connections without --character-set being set
default_character_set = utf8mb4
# whether to enable LOAD DATA LOCAL INFILE for connections without --local-infile being set
default_local_infile = False
# How often to send periodic background pings to the server when input is idle. Ticks are
# roughly in seconds, but may be faster. Set to zero to disable. Suggestion: 300.
default_keepalive_ticks = 0
# Sets the desired behavior for handling secure connections to the database server.
# Possible values:
# auto = SSL is preferred for TCP/IP connections. Will attempt to connect via SSL, but will fall
# back to cleartext as needed. Will not attempt to connect with SSL over local sockets.
# on = SSL is required. Will attempt to connect via SSL even on a local socket, and will fail if
# a secure connection is not established.
# off = do not use SSL. Will fail if the server requires a secure connection.
default_ssl_mode = auto
# SSL CA file for connections without --ssl-ca being set
default_ssl_ca =
# SSL CA directory for connections without --ssl-capath being set
default_ssl_capath =
# SSL X509 cert path for connections without --ssl-cert being set
default_ssl_cert =
# SSL X509 key for connections without --ssl-key being set
default_ssl_key =
# SSL cipher to use for connections without --ssl-cipher being set
default_ssl_cipher =
# whether to verify server's "Common Name" in its cert, for connections without
# --ssl-verify-server-cert being set
default_ssl_verify_server_cert = False
[llm]
# If set to a positive integer, truncate text/binary fields to that width
# in bytes when sending sample data, to conserve tokens. Suggestion: 1024.
prompt_field_truncate = None
# If set to a positive integer, attempt to truncate various sections of LLM
# prompt input to that number in bytes, to conserve tokens. Suggestion:
# 1000000.
prompt_section_truncate = None
[keys]
# possible values: exit, none
control_d = exit
# possible values: auto, fzf, reverse_isearch
control_r = auto
# comma-separated list: toolkit_default, summon, advancing_summon, prefixing_summon, advance, cancel
#
# * toolkit_default - ignore other behaviors and use prompt_toolkit's default bindings
# * summon - when completions are not visible, summon them
# * advancing_summon - when completions are not visible, summon them _and_ advance in the list
# * prefixing_summon - when completions are not visible, summon them _and_ insert the common prefix
# * advance - when completions are visible, advance in the list
# * cancel - when completions are visible, toggle the list off
control_space = summon, advance
# comma-separated list: toolkit_default, summon, advancing_summon, prefixing_summon, advance, cancel
tab = advancing_summon, advance
# How long to wait for an Escape key sequence in vi mode.
# 0.5 seconds is the prompt_toolkit default, but vi users may find that too long.
# Shorter values mean that "Escape" alone is recognized more quickly.
vi_ttimeoutlen = 0.1
# How long to wait for an Escape key sequence in Emacs mode.
emacs_ttimeoutlen = 0.5
[ssh]
# Path to the ssh executable used by --ssh-jump.
ssh_executable = ssh
# Options to pass to the ssh executable when making a tunnel.
# The defaults may need to be changed if not using OpenSSH.
ssh_options = -a -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o IPQoS=af13 -o LogLevel=FATAL
# Method for establishing the local side of the SSH tunnel: auto, port, socket.
# auto means: port if on Windows, socket otherwise.
tunnel_method = auto
[kubectl]
# Path to the kubectl executable used by --kubectl-resource.
kubectl_executable = kubectl
# Options to pass to "kubectl port-forward" before the resource name.
# This can be used, for example, to set the context.
kubectl_options =
[vault]
# Path to the vault executable used for Vault integration.
vault_executable = vault
# URL for VAULT_ADDR, if the environment variable is unset.
address =
# Default mount, which can be overridden by --vault-mount at the CLI.
default_mount =
# Field/property containing the password, if --vault-password-field is not provided.
default_password_field = password
# Field/property containing the username, if --vault-username-field is not provided.
default_username_field = username
[boundary]
# Path to the HashiCorp Boundary executable used by --boundary-id.
boundary_executable = boundary
# Address of the Boundary controller. If empty, use Boundary's default resolution.
address =
# Boundary auth method ID. If empty, use BOUNDARY_AUTH_METHOD_ID from the environment.
auth_method_id =
# Additional options passed to the "boundary connect" command.
boundary_options =
# Command used to test whether Boundary authentication is valid.
# If empty, establishing the tunnel will fail when not authenticated.
# If set, boundary_auth_command must also be set.
# Example: boundary targets read -id ttcp_zzzzzzzzzz
boundary_test_command =
# Command used to authenticate when boundary_test_command exits nonzero.
# If empty, establishing the tunnel will fail when not authenticated.
# If set, boundary_test_command must also be set.
# Example: boundary authenticate oidc
boundary_auth_command =
# Custom colors for the completion menu, toolbar, etc, with actual support
# depending on the terminal, and the property being set.
# Colors: #ffffff, bg:#ffffff, border:#ffffff.
# Attributes: (no)blink, bold, dim, hidden, inherit, italic, reverse, strike, underline.
[colors]
# Completion menus
completion-menu.completion.current = 'bg:#ffffff #000000'
completion-menu.completion = 'bg:#008888 #ffffff'
completion-menu.completion.indexed = 'bg:#008888 #ffffff'
completion-menu.meta.completion.current = 'bg:#44aaaa #000000'
completion-menu.meta.completion = 'bg:#448888 #ffffff'
completion-menu.multi-column-meta = 'bg:#aaffff #000000'
scrollbar.arrow = 'bg:#003333'
scrollbar = 'bg:#00aaaa'
# The prompt
prompt = ''
continuation = ''
# Colored table output (query results)
output.table-separator = ""
output.header = "#00ff5f bold"
output.odd-row = ""
output.even-row = ""
output.null = "#808080"
output.status = ""
output.status.warning-count = ""
output.timing = ""
# Selected text (native selection; currently unused)
selected = '#ffffff bg:#6666aa'
# Search matches (for reverse i-search, not fuzzy search)
search = '#ffffff bg:#4444aa'
search.current = '#ffffff bg:#44aa44'
# UI elements: bottom toolbar
bottom-toolbar = 'bg:#222222 #aaaaaa'
bottom-toolbar.off = 'bg:#222222 #888888'
bottom-toolbar.on = 'bg:#222222 #ffffff'
bottom-toolbar.transaction.valid = 'bg:#222222 #00ff5f bold'
bottom-toolbar.transaction.failed = 'bg:#222222 #ff005f bold'
# UI elements: other toolbars (currently unused)
search-toolbar = 'noinherit bold'
search-toolbar.text = 'nobold'
system-toolbar = 'noinherit bold'
arg-toolbar = 'noinherit bold'
arg-toolbar.text = 'nobold'
# SQL enhacements: matching brackets
matching-bracket.cursor = '#ff8888 bg:#880000'
matching-bracket.other = '#000000 bg:#aacccc'
# SQL syntax highlighting overrides: normally defined by main.syntax_style
# sql.comment = 'italic #408080'
# sql.comment.multi-line = ''
# sql.comment.single-line = ''
# sql.comment.optimizer-hint = ''
# sql.escape = 'border:#FF0000'
# sql.keyword = 'bold #008000'
# sql.datatype = 'nobold #B00040'
# sql.literal = ''
# sql.literal.date = ''
# sql.symbol = ''
# sql.quoted-schema-object = ''
# sql.quoted-schema-object.escape = ''
# sql.constant = '#880000'
# sql.function = '#0000FF'
# sql.variable = '#19177C'
# sql.number = '#666666'
# sql.number.binary = ''
# sql.number.float = ''
# sql.number.hex = ''
# sql.number.integer = ''
# sql.operator = '#666666'
# sql.punctuation = ''
# sql.string = '#BA2121'
# sql.string.double-quouted = ''
# sql.string.escape = 'bold #BB6622'
# sql.string.single-quoted = ''
# sql.whitespace = ''
# Favorite queries.
# You can add your favorite queries here. They will be available in the
# REPL when you type `/f` or `/f <query_name>`.
# Define multiine favorite queries using '''triplequotes'''.
[favorite_queries]
# example = "SELECT * FROM example_table WHERE id = 1"
#
# Favorite queries can use the Jinja templating language. Named argument
# values are available as keys in a dictionary named "kv".
# Run this example templated query with: /f find_user --name=henry
# Any keys refereed to by name will be available as completions.
# find_user = "SELECT * FROM users WHERE name = '{{ kv.name }}'"
#
# Jinja parameters are optional.
# Run this example templated query with: /f recent_user --name=henry
# or alternatively, with different behavior: /f recent_user
# recent_user = "SELECT * FROM users WHERE create_date >= NOW() - INTERVAL 1 DAY {% if kv.name %} AND name = '{{ kv.name }}' {% endif %}"
#
# Since "kv" is a Python dictionary, collisions with existing dictionary
# methods will require extra syntax, as will keys with internal dashes:
# example = "SELECT * FROM example_table WHERE id = {{ kv['get'] }}"
# example = "SELECT * FROM example_table WHERE id = {{ kv['my-id'] }}"
#
# Mandatory positional arguments are also supported:
# Run this example templated query with: /f find_user henry
# find_user = "SELECT * FROM users WHERE name = '$1'"
#
# Plase ambiguous positional arguments after "--":
# /f find_user -- --unusual-name--
# Initial commands to execute when connecting to any database.
[init-commands]
# read_only = "SET SESSION TRANSACTION READ ONLY"
# Use the -d option to reference a DSN.
# Special characters in passwords and other strings can be escaped with URL encoding.
[alias_dsn]
# example_dsn = mysql://[user[:password]@][host][:port][/dbname]
# Initial commands to execute when connecting to a DSN alias.
[alias_dsn.init-commands]
# Define one or more SQL statements per alias (semicolon-separated).
# example_dsn = "SET sql_select_limit=1000; SET time_zone='+00:00'"