日期:2014-05-16  浏览次数:20721 次

使用tee记录mysql client 所有的操作
方法一、配置文件
在服务器上的/etc/my.cnf中的[client]加入
tee =/tmp/client_mysql.log即可.


方法二、命令行
1.mysql -uroot --tee=/tmp/client_mysql.log

2.这个类似于sqlplus的spool功能,可以将命令行中的结果保存到外部文件中。如果指定已经存在的文件,则结果会附加到文件中。
mysql> tee client_mysql.log
Logging to file 'client_mysql.log '
或者
mysql> \T client_mysql.log
Logging to file 'client_mysql.log '

mysql> notee
Outfile disabled.
或者
mysql> \t
Outfile disabled.