June 18, 2012 · Mysql Mysql Client Logging
Client side logging in mysql
When using the mysql CLI users typically have two options when it comes to logging at the client side.
- Statement only logging can be found in
~/.mysql_history
(see here - Statement & result, etc logging can be obtained through the use of the
tee
andnotee
commands. Thetee
command specifies a file to record all subsequent output to, including statement and results. Thenotee
command terminates the recording of the session.
mysql> tee /home/someuser/session_log_123.txt
mysql> SELECT * FROM .....;
mysql> ....some results
mysql> notee
mysql> \! cat /home/someuser/session_log_123.txt