MySQL命令行客戶端:mycli

dgbm 9年前發布 | 76K 次閱讀 mycli MySQL 數據庫服務器

一個MySQL的命令行客戶端,具有自動完成和語法高亮的功能。

Completion CompletionGif

Postgres 的命令行: http://pgcli.com

快速入門

假如你已經知道如何安裝 python 包,你就可以通過pip安裝它:

You might need sudo on linux.

$ pip install mycli

or

$ brew install mycli  # Only on OS X

Check the detailed install instructions for debian packages or getting started with pip.

用法

$ mycli --help
Usage: mycli [OPTIONS] [DATABASE]

Options:
  -h, --host TEXT         Host address of the database.
  -P, --port TEXT         Port number to use for connection. Honors
                          $MYSQL_TCP_PORT
  -u, --user TEXT         User name to connect to the database.
  -S, --socket TEXT       The socket file to use for connection.
  -p, --password          Force password prompt.
  --pass TEXT             Password to connect to the database
  -v, --version           Version of mycli.
  -D, --database TEXT     Database to use.
  -R, --prompt TEXT       Prompt format (Default: "\t \u@\h:\d> ")
  -l, --logfile FILENAME  Log every query and its results to a file.
  --help                  Show this message and exit.

Examples

$ mycli local_database

$ mycli -h localhost -u root app_db

$ mycli mysql://amjith@localhost:3306/django_poll

特性

mycliis 使用 prompt_toolkit開發

  • 輸入提示當你輸入SQL關鍵字時,包括數據庫中的表格和字段
  • 使用Pygments實現語法高亮
  • 智能補全(默認啟用),會提示上下文敏感的完成。

    • SELECT * FROM <tab>will only show table names.
    • SELECT * FROM users WHERE <tab>will only show column names.
  • Config file is automatically created at~/.myclircat first launch.

  • Pretty prints tabular data.

項目主頁:http://www.baiduhome.net/lib/view/home/1438317378472

 本文由用戶 dgbm 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!