mysql -e加v簡(jiǎn)化代碼
用 mysql -e 生成結(jié)果導(dǎo)入指定文件時(shí):
● 若要同時(shí)顯示語句本身:-v
● 若要增加查詢結(jié)果行數(shù):-vv
● 若要增加執(zhí)行時(shí)間:-vvv
在一些監(jiān)控腳本中可以用來簡(jiǎn)化代碼
[plain]
㈠ 不帶 v 測(cè)試:
[mysql@even ~]$ mysql -uroot -poracle -e "SELECT VERSION();SELECT NOW()" > /home/mysql/test.sql
[mysql@even ~]$ cat /home/mysql/test.sql
VERSION()
5.5.16-log
NOW()
2013-05-08 18:06:35
㈡ 帶一個(gè) v 測(cè)試:
[mysql@even ~]$ mysql -uroot -poracle -e "SELECT VERSION();SELECT NOW()" -v > /home/mysql/test02.sql
[mysql@even ~]$ cat /home/mysql/test02.sql
--------------
SELECT VERSION()
--------------
VERSION()
5.5.16-log
--------------
SELECT NOW()
--------------
NOW()
2013-05-08 18:08:40
㈢ 帶兩個(gè) v 測(cè)試:
[mysql@even ~]$ mysql -uroot -poracle -e "SELECT VERSION();SELECT NOW()" -vv > /home/mysql/test03.sql
[mysql@even ~]$ cat /home/mysql/test03.sql
--------------
SELECT VERSION()
--------------
VERSION()
5.5.16-log
1 row in set
--------------
SELECT NOW()
--------------
NOW()
2013-05-08 18:14:05
1 row in set
Bye
㈢ 帶三個(gè) v 測(cè)試:
[mysql@even ~]$ mysql -uroot -poracle -e "SELECT VERSION();SELECT NOW()" -vvv > /home/mysql/test04.sql
[mysql@even ~]$ cat /home/mysql/test04.sql
--------------
SELECT VERSION()
--------------
+------------+
| VERSION() |
+------------+
| 5.5.16-log |
+------------+
1 row in set (0.00 sec)
--------------
SELECT NOW()
--------------
+---------------------+
| NOW() |
+---------------------+
| 2013-05-08 18:14:49 |
+---------------------+
1 row in set (0.00 sec)
Bye
bitsCN.com聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com