Home > Database > Mysql Tutorial > mysql -e加v简化代码_MySQL

mysql -e加v简化代码_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:34:56
Original
1291 people have browsed it

bitsCN.com

mysql -e加v简化代码

 

   用 mysql -e 生成结果导入指定文件时:

     

     ● 若要同时显示语句本身:-v

     ● 若要增加查询结果行数:-vv

     ● 若要增加执行时间:-vvv 

     

     在一些监控脚本中可以用来简化代码

 

[plain] 

㈠ 不带 v 测试:  

  

[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  

  

  

㈡ 带一个 v 测试:  

  

[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  

  

  

㈢ 带两个 v 测试:  

  

[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  

  

  

㈢ 带三个 v 测试:  

  

  

[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
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template