2017年1月3日

shell script 使用 mysql 命令小技巧

mysql $db -BNse "select host from hostwerer"

-B, --batch, 也就是以[Tab]字元做為輸出結果的欄間分隔字元.

-N, --skip-column-names, 不顯示列訊息.

-s, --silent, silent mode, 不輸出執行過程的說明文字.

-e, --execute=statement, 執行statement的命令, 然後離開.


mysql $db -e "select host from hostwerer"



mysql $db -se "select host from hostwerer"


mysql $db -Ne "select host from hostwerer"


mysql $db -Nse "select host from hostwerer"



reference:
MySQL -Bse 是什意思?
How can I suppress column header output for a single SQL statement?

0 意見:

張貼留言