溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

mysql實用工具

發(fā)布時間:2020-05-21 19:17:13 來源:網(wǎng)絡(luò) 閱讀:792 作者:yzy121403725 欄目:MySQL數(shù)據(jù)庫

mysql 命令行補全工具 mycli

前言

我們在連接mysql數(shù)據(jù)庫的時候,大多數(shù)情況下是使用gui圖形界面的工具的。但是,有時候連接數(shù)據(jù)庫還是命令行方便,所以,我們通常都需要掌握一點命令行操作數(shù)據(jù)庫的基礎(chǔ)。

這里推薦一篇文章給大家看Mysql命令大全,這里包含了絕大多數(shù)我們需要用到的mysql命令。

但是,默認(rèn)的mysql命令行是不支持補全的,并且很討厭的是,我們輸入了錯誤的命令之后,由于命令行操作習(xí)慣,按ctrl+c想要取消的時候,tmd已經(jīng)退出了mysql命令行工具。只能再次連接。想要刪除錯誤的命令只能 ctrl+a ctrl+u進(jìn)行刪除?;蛘咭恢卑碿trl+w進(jìn)行刪除。

還有,每個命令必須以;分號結(jié)尾,而我這樣的馬大哈老是忘記。

最重要的是,這玩意兒不支持補全!我這樣的人,沒有補全怎么操作命令行哦!

今天看到github上有一個開源項目叫mycli,感覺非常好,安裝使用了一下,果然牛逼,已經(jīng)克服了我的Mysql命令行操作恐懼了!因此,推薦給大家!

安裝

官方網(wǎng)站:http://mycli.net
github地址:https://github.com/dbcli/mycli

操作演示

mac安裝方法

$ brew update && brew install mycli
ubuntu安裝命令
sudo apt-get install mycli
arch安裝命令
sudo pacman -S mycli
windows未測試,手頭上沒有windows系統(tǒng)。

使用方法

$ 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.
連接數(shù)據(jù)庫

$ mycli local_database

$ mycli -h localhost -u root app_db

$ mycli mysql://amjith@localhost:3306/django_poll

如果你熟練使用Mysql命令行,那么使用這個工具沒有任何問題。如果你不熟練,使用這個工具可以跟快的使你熟練!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI