The tee function of Mysql is used to record user operation records. Due to a large number of changes to mysql, such as deletion, modification, and addition operations, when it comes to the production environment, these operations are sometimes necessary to record the entire operation for checking and searching. The Tee function is similar to the spool in oracle. The following test methods are available for different tee protection methods:
1. directly specify the file
This is because the spool 'file path' is used each time the spool is used, and spool off is used after the spool is finished. The following is a test:
At first glance, it seems that the file and path are correctly specified, so do we see this tee in this path. log, go to the tmp directory under the root directory of the mysql user, and check that tee has been generated. log file, and then run some simple operations to test whether the record is successful;
View the tee. log File. All operation records and results are recorded in real time. A little different from oracle, oracle is generated after spool off every time (it should be wrong ). Use the notee or \ t command to disable it.
2. Enable the -- tee Parameter
Run mysql-uroot-p -- tee =/home/mysql/tmp/ceshi. log-S/usr/local/mysql/tmp/3306/mysql. after logging on to sock successfully, test the operation record again as usual.
View ceshi. log. All records are recorded in real time.
3. Change the configuration file my. CNF.
In the test environment, kill the mysqld service first (this configuration is not added to my. cnf in the production environment. It is only used for testing ).
Close mysql, modify the [client] Option section in the mysql configuration file, and add the following content:
[Client]
Port = 3306
Socket =/usr/local/mysql/tmp/3306/mysql. sock
Default-character-set = utf8
Tee =/home/MySQL/tmp/result. Log
Start MySQL again and check whether results are generated under/home/MySQL/tmp. the log file is not displayed at a Glance. It is strange that this method is correct. Most of the information I found on the Internet is about these three points. Is there a problem with the version? I installed a 32-bit MySQL 5.1.57 on the local machine. So I switched to another machine and tested MySQL 5.1.50 with a 64-bit version;
MySQL is restarted with the same configuration. No results are found after the test;
In the original MySQL configuration file, there were differences in different versions. Currently, some versions of MySQL database's tee function does not take effect when writing the configuration file, however, it supports direct command line operations under the terminal. For example, the above two versions have no effect, so it is not safe to write them into the configuration file. At present, I still don't know why. I guess there may also be bugs in some versions. I hope you will be enlightened.