开发者

Quick way to email results of a mysql query

开发者 https://www.devze.com 2023-04-01 16:58 出处:网络
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.mysql -u .. -p.. -H <<<\

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.


mysql -u .. -p.. -H <<<"your query" | mutt -s 'subject' email@email.com

if you consider HTML is better formatting

personally, i prefer \G

mysql -u .. -p.. -N <<<"your query\G" | mail -s 'subject' email@email.com


Alternative to the other mutt answer is just plain old mail from the mailx package:

mysql -uuser -ppass dbname < queryfile.sql | mail -s 'Your query output' email@example.com


mysql -u <user> -p<password> <database> -e "<query>" | sendmail <emailaddress>
0

精彩评论

暂无评论...
验证码 换一张
取 消