mycli是一个具有自动补齐输入和语法高亮的MySQL命令行接口。官方网站:http://mycli.net
使用python安装mycli,
$ pip install mycli
mycli的基础语法:
$ mycli --help
Usage: mycli [OPTIONS] [DATABASE]
Options:
-h, --host TEXT Host address of the database.
-P, --port TEXT 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 Force password prompt.
--pass TEXT Password to connect to the database
-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.
--help Show this message and exit.
例子
$ mycli local_database
$ mycli -h localhost -u root app_db
$ mycli -h localhost -u root -p
$ mycli mysql://amjith@localhost:3306/django_poll