[20131211]mysql pager定义=vim.txt

[20131211]mysql pager定义=vim.txt

今天看厂家调试安全设备,发现后台数据库使用mysql。我发现他select * from 自己一点也不熟悉mysql,不过我在公司使用cacti监控各种设备以及服务器,自己也测试看看。

# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14542484 to server version: 4.1.12

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use cacti
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> help

For the complete MySQL Manual online, visit:
   http://www.mysql.com/documentation

For info on technical support from MySQL developers, visit:
   http://www.mysql.com/support

For info on MySQL books, utilities, consultants, etc., visit:
   http://www.mysql.com/portal

List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
?         (\?) Synonym for `help'.
clear     (\c) Clear command.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set query delimiter.
edit      (\e) Edit command with $EDITOR.
ego       (\G) Send command to mysql server, display result vertically.
exit      (\q) Exit mysql. Same as quit.
go        (\g) Send command to mysql server.
help      (\h) Display this help.
nopager   (\n) Disable pager, print to stdout.
notee     (\t) Don't write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (\p) Print current command.
prompt    (\R) Change your mysql prompt.
quit      (\q) Quit mysql.
rehash    (\#) Rebuild completion hash.
source    (\.) Execute a SQL script file. Takes a file name as an argument.
status    (\s) Get status information from the server.
system    (\!) Execute a system shell command.
tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
use       (\u) Use another database. Takes database name as argument.

For server side help, type 'help contents'

--很明显修改pager参数就可以实现。

我执行如下:
mysql> pager vim
mysql> select * from cdef;

--不行。修改如下:

mysql> pager vim -
mysql> select * from cdef;

--ok通过!很明显这个结果仅仅read only。这样设置vim只读
mysql> pager vim -R -c "set nowrap" -

--可惜oracle没有这个特性。如果要永久有效,加入/etc/my.cnf文件中加入如下:
[mysql]
pager=vim -R -c "set nowrap syntax=txt" -

--google 查询mysql pager 还可以发现许多有趣的例子。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-1062965/,如需转载,请注明出处,否则将追究法律责任。

user_pic_default.png
请登录后发表评论 登录
全部评论
<%=items[i].createtime%>

<%=items[i].content%>

<%if(items[i].items.items.length) { %>
<%for(var j=0;j
<%=items[i].items.items[j].createtime%> 回复

<%=items[i].items.items[j].username%>   回复   <%=items[i].items.items[j].tousername%><%=items[i].items.items[j].content%>

<%}%> <%if(items[i].items.total > 5) { %>
还有<%=items[i].items.total-5%>条评论 ) data-count=1 data-flag=true>点击查看
<%}%>
<%}%> <%}%>

转载于:http://blog.itpub.net/267265/viewspace-1062965/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值