I am trying to get the log from MySQL into a file when executing a script from the command line.
For example
mysql -v mydb u- alex -p**** < please_run_me.sql > /tmp/file.log
Now, the work gets done, but file.log is empty. I thought that -v would give me the desired output. I would like to understand how I
- Get output from MySQL into file.log
- Or better, only get content into file.log if the job fails (but both is handy as when I am testing far the command line I would like to know what is going on)
- Emails myself the error and/or whatever
(Eventually this will end as a cron job).