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.
Percona’s widely read Percona Data Performance blog highlights our expertise in enterprise-class software, support, consulting and managed services solutions for both MySQL® and MongoDB® across traditional and cloud-based platforms. The decades of experience represented by our consultants is found daily in numerous and relevant blog posts.
Besides specific database help, the blog also provides notices on upcoming events and webinars.
Want to get weekly updates listing the latest blog posts? Subscribe to our blog now! Submit your email address below and we’ll send you an update every Friday at 1pm ET.