早就听说mycli很好用,今天打算在本地测试机上装一下体验一把。
安装方法很是简单:

一、安装依赖:

  1. yum install python-pip python-devel

二、安装mycli

  1. pip install mycli

这样就安装完了。

三、使用方法

  1. [root@localhost .pip]# mycli --help
  2. Usage: mycli [OPTIONS] [DATABASE]
  3. A MySQL terminal client with auto-completion and syntax highlighting.
  4. Examples:
  5. - mycli my_database
  6. - mycli -u my_user -h my_host.com my_database
  7. - mycli mysql://my_user@my_host.com:3306/my_database
  8. Options:
  9. -h, --host TEXT Host address of the database.
  10. -P, --port INTEGER Port number to use for connection. Honors
  11. $MYSQL_TCP_PORT.
  12. -u, --user TEXT User name to connect to the database.
  13. -S, --socket TEXT The socket file to use for connection.
  14. -p, --password TEXT Password to connect to the database.
  15. --pass TEXT Password to connect to the database.
  16. --ssl-ca PATH CA file in PEM format.
  17. --ssl-capath TEXT CA directory.
  18. --ssl-cert PATH X509 cert in PEM format.
  19. --ssl-key PATH X509 key in PEM format.
  20. --ssl-cipher TEXT SSL cipher to use.
  21. --ssl-verify-server-cert Verify server's "Common Name" in its cert
  22. against hostname used when connecting. This
  23. option is disabled by default.
  24. -v, --version Output mycli's version.
  25. -D, --database TEXT Database to use.
  26. -d, --dsn TEXT Use DSN configured into the [alias_dsn]
  27. section of myclirc file.
  28. -R, --prompt TEXT Prompt format (Default: "\t \u@\h:\d> ").
  29. -l, --logfile FILENAME Log every query and its results to a file.
  30. --defaults-group-suffix TEXT Read MySQL config groups with the specified
  31. suffix.
  32. --defaults-file PATH Only read MySQL options from the given file.
  33. --myclirc PATH Location of myclirc file.
  34. --auto-vertical-output Automatically switch to vertical output mode
  35. if the result is wider than the terminal
  36. width.
  37. -t, --table Display batch output in table format.
  38. --csv Display batch output in CSV format.
  39. --warn / --no-warn Warn before running a destructive query.
  40. --local-infile BOOLEAN Enable/disable LOAD DATA LOCAL INFILE.
  41. --login-path TEXT Read this path from the login file.
  42. -e, --execute TEXT Execute command and quit.
  43. --help Show this message and exit.

参数选项不多,直接当成mysql客户端来使用即可。

四、体验

【MySQL】mycli初体验 - 图1

体验了一下,还是挺不错的,语法高亮,还能自动补全。