https://github.com/dbcli/mycli
A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
https://github.com/dbcli/mycli
auto-completion database mycli mysql python syntax-highlighting
Last synced: 17 days ago
JSON representation
A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
- Host: GitHub
- URL: https://github.com/dbcli/mycli
- Owner: dbcli
- License: other
- Created: 2015-04-05T22:39:49.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2025-04-28T10:41:06.000Z (10 months ago)
- Last Synced: 2025-04-28T17:01:49.046Z (10 months ago)
- Topics: auto-completion, database, mycli, mysql, python, syntax-highlighting
- Language: Python
- Homepage: http://mycli.net
- Size: 2.42 MB
- Stars: 11,612
- Watchers: 186
- Forks: 666
- Open Issues: 181
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Authors: AUTHORS.rst
Awesome Lists containing this project
- awesome - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
- stars - dbcli/mycli
- fucking-awesome-python-cn - mycli
- fucking_awesome_python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- my-awesome-list - mycli
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- awesome-cli-apps - mycli - MySQL client with autocompletion and syntax highlighting. (Development / Database)
- fucking-Awesome-Linux-Software - ![Open-Source Software - MyCLI is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting. (Applications / Development)
- mac-awesomeTools - mycli - 为MySQL命令行客户端,提供语法高亮和提示功能的工具! [![Open-Source Software][OSS Icon]](https://github.com/dbcli/mycli) ![Freeware][Freeware Icon] (开发者工具)
- awesome-python-zh - mycli - 具有自动完成和语法突出显示功能的MySQL CLI。 (命令行工具)
- fucking-awesome-cli-apps - mycli - MySQL client with autocompletion and syntax highlighting. (Development / Database)
- awesome-engineering-toolbox - mycli - MySQL client with auto-completion and syntax highlighting. (Database Tools / Learning Resources)
- Awesome-Linux-Software -  (Tools / Python)
- awesome-mac - mycli - 为MySQL命令行客户端,提供语法高亮和提示功能的工具! [![Open-Source Software][OSS Icon]](https://github.com/dbcli/mycli) ![Freeware][Freeware Icon] ![tuijian][tuijian Icon] ![star 5][star5 Icon] (命令行工具)
- awesome-python - mycli - MySQL CLI with autocompletion and syntax highlighting. (Command-line Tools)
- awesome-mysql - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (GUI)
- python-awesome - mycli - MySQL CLI with autocompletion and syntax highlighting. (Command-line Tools)
- awesome-python-resources - GitHub - 28% open · ⏱️ 14.08.2022): (命令行工具)
- awesomeLibrary - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (语言资源库 / python)
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. ` 📝 2 months ago` (Command-line Tools [🔝](#readme))
- awesome-mac - mycli - CLI for MySQL that can do auto-completion and syntax highlighting. [![Open-Source Software][OSS Icon]](https://github.com/dbcli/mycli) ![Freeware][Freeware Icon] (Developer Tools / Command Line Tools)
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- fucking-awesome-python - mycli - MySQL CLI with autocompletion and syntax highlighting. (Command-line Tools)
- fucking-awesome-python - :octocat: mycli - :star: 10970 :fork_and_knife: 650 - MySQL CLI with autocompletion and syntax highlighting. (Command-line Tools)
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- awesome-starred - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
- awesome-cli-apps-in-a-csv - mycli - A command line client for MySQL that can do autocompletion and syntax highlighting. (<a name="data-management-tabular"></a>Data management - Tabular data)
- awesome-github-star - mycli
- awesome-python-cn - mycli
- Awesome-Python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- Python-Awesome - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- command-line-tools - mycli - Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Other)
- awesome-python - mycli - MySQL CLI with autocompletion and syntax highlighting. (Command-line Tools)
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Awesome Python / Command-line Tools)
- awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- starred-awesome - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
- awesome-fancy-toolkit - MySQL命令行自动补全/语法高亮工具, mycli
- git-github.com-vinta-awesome-python - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Command-line Tools)
- awesome-cli-apps - mycli - A command line client for MySQL that can do autocompletion and syntax highlighting. (<a name="data-management-tabular"></a>Data management - Tabular data)
- awesome-starts - dbcli/mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
- awesome-hacking-lists - dbcli/mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
- awesome-db-tools - mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (CLI / dbcli)
- awesome-sql - mycli
- awesome-rainmana - dbcli/mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
- awesome-repositories - dbcli/mycli - A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting. (Python)
README
# mycli
[](https://github.com/dbcli/mycli/actions?query=workflow%3Amycli)
A command line client for MySQL that can do auto-completion and syntax highlighting.
Homepage: [http://mycli.net](http://mycli.net)
Documentation: [http://mycli.net/docs](http://mycli.net/docs)


Postgres Equivalent: [http://pgcli.com](http://pgcli.com)
Quick Start
-----------
If you already know how to install Python packages, then you can install it via `pip`:
You might need sudo on Linux.
```bash
pip install -U 'mycli[all]'
```
or
```bash
brew update && brew install mycli # Only on macOS
```
or
```bash
sudo apt-get install mycli # Only on Debian or Ubuntu
```
### Usage
See
```bash
mycli --help
```
Features
--------
`mycli` is written using [prompt_toolkit](https://github.com/jonathanslenders/python-prompt-toolkit/).
* Auto-completion as you type for SQL keywords as well as tables, views and
columns in the database.
* Syntax highlighting using Pygments.
* Smart-completion (enabled by default) will suggest context-sensitive completion.
- `SELECT * FROM ` will only show table names.
- `SELECT * FROM users WHERE ` will only show column names.
* Support for multiline queries.
* Favorite queries with optional positional parameters. Save a query using
`\fs alias query` and execute it with `\f alias` whenever you need.
* Timing of sql statements and table rendering.
* Config file is automatically created at ``~/.myclirc`` at first launch.
* Log every query and its results to a file (disabled by default).
* Pretty prints tabular data (with colors!)
* Support for SSL connections
* Shell-style trailing redirects with `$>`, `$>>` and `$|` operators.
* Some features are only exposed as [key bindings](doc/key_bindings.rst)
Contributions:
--------------
If you're interested in contributing to this project, first of all I would like
to extend my heartfelt gratitude. I've written a small doc to describe how to
get this running in a development setup.
https://github.com/dbcli/mycli/blob/main/CONTRIBUTING.md
## Additional Install Instructions:
These are some alternative ways to install mycli that are not managed by our team but provided by OS package maintainers. These packages could be slightly out of date and take time to release the latest version.
### Arch, Manjaro
You can install the mycli package available in the AUR:
```
yay -S mycli
```
### Debian, Ubuntu
On Debian, Ubuntu distributions, you can easily install the mycli package using apt:
```
sudo apt-get install mycli
```
### Fedora
Fedora has a package available for mycli, install it using dnf:
```
sudo dnf install mycli
```
### Windows
#### Option 1: Native Windows
Install the `less` pager, for example by `scoop install less`.
Follow the instructions on this blogpost: http://web.archive.org/web/20221006045208/https://www.codewall.co.uk/installing-using-mycli-on-windows/
**Mycli is not tested on Windows**, but the libraries used in the app are Windows-compatible.
This means it should work without any modifications, but isn't supported.
PRs to add native Windows testing to Mycli CI would be welcome!
#### Option 2: WSL
Everything should work as expected in WSL. This is a good option for using
Mycli on Windows.
### Thanks:
This project was funded through kickstarter. My thanks to the [backers](http://mycli.net/sponsors) who supported the project.
A special thanks to [Jonathan Slenders](https://twitter.com/jonathan_s) for
creating [Python Prompt Toolkit](http://github.com/jonathanslenders/python-prompt-toolkit),
which is quite literally the backbone library, that made this app possible.
Jonathan has also provided valuable feedback and support during the development
of this app.
[Click](http://click.pocoo.org/) is used for command line option parsing
and printing error messages.
Thanks to [PyMysql](https://github.com/PyMySQL/PyMySQL) for a pure python adapter to MySQL database.
### Compatibility
Mycli is tested on macOS and Linux, and requires Python 3.10 or better.
To connect to MySQL versions earlier than 5.5, you may need to set the following in `~/.myclirc`:
```
# character set for connections without --charset being set at the CLI
default_character_set = utf8
```
or set `--charset=utf8` when invoking MyCLI.
### Configuration and Usage
For more information on using and configuring mycli, [check out our documentation](http://mycli.net/docs).
Common topics include:
- [Configuring mycli](http://mycli.net/config)
- [Using/Disabling the pager](http://mycli.net/pager)
- [Syntax colors](http://mycli.net/syntax)