Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick way to email results of a mysql query

Tags:

linux

mysql

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.

like image 961
killdash9 Avatar asked Sep 01 '11 16:09

killdash9


1 Answers

mysql -u .. -p.. -H <<<"your query" | mutt -s 'subject' [email protected]

if you consider HTML is better formatting

personally, i prefer \G

mysql -u .. -p.. -N <<<"your query\G" | mail -s 'subject' [email protected]
like image 92
ajreal Avatar answered Sep 18 '22 00:09

ajreal