0

mycli 命令行MySQL管理工具

neo created at6 years ago view count: 2586

mycli

MySQL命令行管理工具, 喜欢在终端里面执行操作的键盘党值得一试。比mysql命令增加了太多功能。

https://github.com/dbcli/mycli

功能

  1. 主动补全SQL相关关键词,还能补全数据库中table, view, column 等相关信息。
  2. 语法高亮
  3. 智能补全, 根据上下文智能补全, SELECT * FROM <tab> 按tab补全的是table名称。
  4. 支持多条SQL执行。
  5. 支持收藏SQL。\fs queryname query 收藏, \fs queryname 执行收藏的SQL。
  6. 显示SQL语句执行时间, 支持表格形式输出结果。
  7. 可以使用Log记录每一条SQL执行结果。
  8. 支持SSL连接。

安装

  • Python pip 安装: pip install -U mycli
  • MacOS 安装: brew update && brew install mycli
  • Ubuntu 和 debian :sudo apt-get install mycli

用法详解

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

  A MySQL terminal client with auto-completion and syntax highlighting.

  Examples:
    - mycli my_database
    - mycli -u my_user -h my_host.com my_database
    - mycli mysql://my_user@my_host.com:3306/my_database

Options:
  -h, --host TEXT               Host address of the database.
  -P, --port INTEGER            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 TEXT           Password to connect to the database.
  --pass TEXT                   Password to connect to the database.
  --ssl-ca PATH                 CA file in PEM format.
  --ssl-capath TEXT             CA directory.
  --ssl-cert PATH               X509 cert in PEM format.
  --ssl-key PATH                X509 key in PEM format.
  --ssl-cipher TEXT             SSL cipher to use.
  --ssl-verify-server-cert      Verify server's "Common Name" in its cert
                                against hostname used when connecting. This
                                option is disabled by default.
  -v, --version                 Output mycli's version.
  -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.
  --defaults-group-suffix TEXT  Read MySQL config groups with the specified
                                suffix.
  --defaults-file PATH          Only read MySQL options from the given file.
  --myclirc PATH                Location of myclirc file.
  --auto-vertical-output        Automatically switch to vertical output mode
                                if the result is wider than the terminal
                                width.
  -t, --table                   Display batch output in table format.
  --csv                         Display batch output in CSV format.
  --warn / --no-warn            Warn before running a destructive query.
  --local-infile BOOLEAN        Enable/disable LOAD DATA LOCAL INFILE.
  --login-path TEXT             Read this path from the login file.
  -e, --execute TEXT            Execute command and quit.
  --help                        Show this message and exit.
report
回复
0
6 years ago 回复
0

不错。 看了下还支持key binding。 Vi党 Emacs党的福音。之前Vi都是通过设置.inputrc来自定义mysql。set editing-mode vi

6 years ago 回复

Recent search keywords