{"id":9967,"library":"mycli","title":"MyCLI - CLI for MySQL Database","description":"mycli is an interactive command-line client for MySQL, MariaDB, and Percona databases, featuring auto-completion, syntax highlighting, and smart suggestions. It's built on prompt_toolkit and pygments, providing a user-friendly and efficient interface for database administration and querying. The current version is 1.68.1, with a release cadence of minor versions every few weeks to months.","status":"active","version":"1.68.1","language":"en","source_language":"en","source_url":"https://github.com/dbcli/mycli","tags":["cli","mysql","mariadb","percona","database","autocomplete","syntax-highlighting","tool"],"install":[{"cmd":"pip install mycli","lang":"bash","label":"Install MyCLI"}],"dependencies":[],"imports":[{"note":"MyCLI is primarily a command-line interface tool and is not typically imported as a Python library for programmatic use. Its functionality is accessed by running the 'mycli' command in a terminal.","symbol":"mycli","correct":"mycli"}],"quickstart":{"code":"# To connect to a local MySQL instance as root:\nmycli -u root\n\n# To connect to a specific database (e.g., 'testdb') on a remote host (e.g., '192.168.1.100'):\nmycli -h 192.168.1.100 -u myuser -D testdb -p\n\n# To exit the mycli prompt:\n# \\q\n# (or Ctrl+D)","lang":"bash","description":"Start MyCLI from your terminal. You can specify connection parameters like host, user, database, and password directly via command-line flags. If a password is required, you'll be prompted for it interactively."},"warnings":[{"fix":"Use the `--socket` (or `-S`) command-line option or configure it via a `~/.myclirc` configuration file, or standard MySQL client configuration.","message":"The environment variable `$MYSQL_UNIX_PORT` has been deprecated. While it may still work, it is recommended to use standard MySQL client configuration methods or command-line flags for specifying the UNIX socket.","severity":"deprecated","affected_versions":">=1.66.0"},{"fix":"Ensure that when using `--throttle`, you provide a floating-point number (e.g., `mycli --batch input.sql --throttle 0.5`) rather than an integer.","message":"The `--throttle` command-line option, used for limiting query execution rate in batch mode, changed its expected argument type from an integer to a float.","severity":"gotcha","affected_versions":">=1.67.0"},{"fix":"Ensure your build environment has necessary compilers (e.g., `gcc`, `build-essential` on Linux, Xcode command-line tools on macOS). Consider installing MyCLI in a dedicated virtual environment (`python -m venv .venv && source .venv/bin/activate && pip install mycli`) to isolate its dependencies.","message":"MyCLI has frequent updates to its `sqlglot` dependency, sometimes requiring specific minor versions or C extensions. This can occasionally lead to installation failures or runtime issues if dependency conflicts arise or if the C extensions fail to compile.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure MyCLI is installed (`pip install mycli`). If installed but still not found, check your Python installation's `Scripts` or `bin` directory (e.g., `~/.local/bin` on Linux/macOS) and add it to your PATH, or use `python -m mycli` if available.","cause":"The `mycli` executable is either not installed or its installation directory is not included in your system's PATH environment variable.","error":"mycli: command not found"},{"fix":"Double-check your username (`-u`), password (`-p`, MyCLI will prompt if not provided), and host (`-h`). Ensure the MySQL user has privileges to connect from the client's IP address or hostname.","cause":"This is a standard MySQL access denied error. It means the username, password, or host you provided (or defaulted to) is incorrect, or the user lacks privileges to connect from your host.","error":"ERROR 1045 (28000): Access denied for user 'youruser'@'localhost' (using password: NO)"},{"fix":"Do not attempt to `import mycli`. Instead, execute `mycli` directly from your shell. If you need to automate database tasks, consider using a database connector library like `mysql-connector-python` or `PyMySQL`.","cause":"You are trying to import `mycli` as a Python module in a script, but `mycli` is designed as a command-line application, not a library for direct programmatic import of its core functionality.","error":"No module named 'mycli'"}]}