官网

https://www.mycli.net

下载

pip install mycli

用法

  1. # 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. --ssh-user TEXT User name to connect to ssh server.
  17. --ssh-host TEXT Host name to connect to ssh server.
  18. --ssh-port INTEGER Port to connect to ssh server.
  19. --ssh-password TEXT Password to connect to ssh server.
  20. --ssh-key-filename TEXT Private key filename (identify file) for the
  21. ssh connection.
  22. --ssh-config-path TEXT Path to ssh configuration.
  23. --ssh-config-host TEXT Host to connect to ssh server reading from ssh
  24. configuration.
  25. --ssl-ca PATH CA file in PEM format.
  26. --ssl-capath TEXT CA directory.
  27. --ssl-cert PATH X509 cert in PEM format.
  28. --ssl-key PATH X509 key in PEM format.
  29. --ssl-cipher TEXT SSL cipher to use.
  30. --ssl-verify-server-cert Verify server's "Common Name" in its cert
  31. against hostname used when connecting. This
  32. option is disabled by default.
  33. -V, --version Output mycli's version.
  34. -v, --verbose Verbose output.
  35. -D, --database TEXT Database to use.
  36. -d, --dsn TEXT Use DSN configured into the [alias_dsn]
  37. section of myclirc file.
  38. --list-dsn list of DSN configured into the [alias_dsn]
  39. section of myclirc file.
  40. --list-ssh-config list ssh configurations in the ssh config
  41. (requires paramiko).
  42. -R, --prompt TEXT Prompt format (Default: "\t \u@\h:\d> ").
  43. -l, --logfile FILENAME Log every query and its results to a file.
  44. --defaults-group-suffix TEXT Read MySQL config groups with the specified
  45. suffix.
  46. --defaults-file PATH Only read MySQL options from the given file.
  47. --myclirc PATH Location of myclirc file.
  48. --auto-vertical-output Automatically switch to vertical output mode
  49. if the result is wider than the terminal
  50. width.
  51. -t, --table Display batch output in table format.
  52. --csv Display batch output in CSV format.
  53. --warn / --no-warn Warn before running a destructive query.
  54. --local-infile BOOLEAN Enable/disable LOAD DATA LOCAL INFILE.
  55. --login-path TEXT Read this path from the login file.
  56. -e, --execute TEXT Execute command and quit.
  57. --help Show this message and exit.

配置

  • C:\Users\<username>\.myclirc 用户配置
  • C:\Users\<username>\.my.cnf 客户端配置