zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

MyCLI 是 MySQL,MariaDB 和 Percona 的命令行界面,具有自动完成和语法突出显示功能。

mysql命令行自动 功能 显示 完成 语法 界面
2023-06-13 09:16:00 时间

MyCLI 是 MySQL,MariaDB 和 Percona 的命令行界面,具有自动完成和语法突出显示功能。

mycli-tablesmycli-tables

mycli 是使用 prompt_toolkit 编写的,有如下特性:

键入SQL关键字以及数据库中的表,视图和列时自动完成。 使用Pygments突出显示语法。 智能完成(默认启用)将建议上下文敏感完成。 SELECT * FROM 仅显示表名。 SELECT * FROM users WHERE 仅显示列名。 支持多行查询。 带有可选位置参数的收藏查询。 使用/ fs别名查询保存查询,并在需要时使用/ f别名执行查询。 sql语句和表呈现的时间。 第一次启动时,会在〜/ .myclirc自动创建配置文件。 将每个查询及其结果记录到文件中(默认情况下禁用)。 漂亮打印表格数据(带颜色!) 支持SSL连接

MyCLI 是 MySQL,MariaDB 和 Percona 的命令行界面,具有自动完成和语法突出显示功能。

如果你已经知道如何安装python包,那么你可以通过pip安装它:

你可能需要在linux上使用sudo。

$ pip install -U mycli

or

$ brew update && brew install mycli # Only on macOS

or

$ sudo apt-get install mycli # Only on debian or ubuntu
Usage
$ 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.

 --ssh-user TEXT User name to connect to ssh server.

 --ssh-host TEXT Host name to connect to ssh server.

 --ssh-port INTEGER Port to connect to ssh server.

 --ssh-password TEXT Password to connect to ssh server.

 --ssh-key-filename TEXT Private key filename (identify file) for the

 ssh connection.

 --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 servers "Common Name" in its cert

 against hostname used when connecting. This

 option is disabled by default.

 -V, --version Output myclis version.

 -v, --verbose Verbose output.

 -D, --database TEXT Database to use.

 -d, --dsn TEXT Use DSN configured into the [alias_dsn]

 section of myclirc file.

 --list-dsn list of DSN configured into the [alias_dsn]

 section of myclirc file.

 -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.

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/58898.html

aliyun