LoginSignup
0
0

More than 3 years have passed since last update.

MyCLI: MySQL、MariaDB、Perconaの自動補完機能を備えたコマンドラインインターフェース

Posted at

MyCLIは、MySQL、MariaDB、Percona用の使いやすいコマンドラインインターフェイス(CLI)で、自動補完機能や構文ハイライト機能で開発のスピードアップを支援します。

本ブログは英語版からの翻訳です。オリジナルはこちらからご確認いただけます。一部機械翻訳を使用しております。翻訳の間違いがありましたら、ご指摘いただけると幸いです。

前提条件

MyCLIツールはPythonをベースにしているので、PIP経由でインストールする必要があります。pipとpython開発ライブラリがインストールされていることを確認してください。ECSインスタンスを正しくセットアップしていれば、以下の3行のコードを実行してMyCLIをインストールするだけです。

yum install python-pip
yum -y install python-devel
pip install mycli

MyCLIの詳細

MyCLI の使い方がわからない場合は、以下に示すように、いつでも —help コマンドを実行して、その様々なオプションについて知ることができます。

$ mycli --help
 Usage: mycli [OPTIONS] [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                 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.
   --defaults-group-suffix TEXT  Read config group with the specified suffix.
   --defaults-file PATH          Only read default 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 query to the database.
   --help                        Show this message and exit.

使用例

以下のコマンドを実行して、ApsaraDB for RDSインスタンス上でMyCLIを実行するだけです。

$ mycli ®Ch{RDS DNS Alias} ®Cu{RDS User Name} -p{RDS Password}

接続されると、デフォルトのCLIを使用するのと同じようにMyCLIを使用することができます。

続きを読むには

また、Alibaba Cloudでは、Alibaba Cloud CLI上で独自のコマンド自動補完機能を提供しています。詳細については、https://www.alibabacloud.com/help/doc-detail/29998.html をご覧ください。

アリババクラウドは日本に2つのデータセンターを有し、世界で60を超えるアベラビリティーゾーンを有するアジア太平洋地域No.1(2019ガートナー)のクラウドインフラ事業者です。
アリババクラウドの詳細は、こちらからご覧ください。
アリババクラウドジャパン公式ページ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0