Posted by peter

Baron recently wrote about very helpful but often forgotten about “Pager” feature of command line client. There is another one which falls into the same list - the –tee option.

Specifying –tee=/path/to/file.log you can get all session content (everything typed in and printed out) stored in the log file. Quite handy for example to keep track of changes done on production.

Moreover you can put tee=/logs/mysql.log in “mysql” section in my.cnf to have logging enabled automatically when you start the client.

If you’re looking to log session beyond MySQL command line client you can check out “script” tool.