killdash9 killdash9 - 1 year ago 74
Linux Question

Quick way to email results of a mysql query

Is there a simple way to email the results of a mysql query from either the mysql console directly or from the linux console? Nice formatting is a bonus.

Answer Source
mysql -u .. -p.. -H <<<"your query" | mutt -s 'subject'

if you consider HTML is better formatting

personally, i prefer \G

mysql -u .. -p.. -N <<<"your query\G" | mail -s 'subject'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download