email - Mysql Export and send mail using Cron job -


i want export select query in mysql , result file needs send mail using cronjob in mysql.

please help, suggest solution.... thanks.

you can execute queries using mysql cli. example:

mysql -u 'db_user' -p'db_pass' -h 'db_host' database_name <<< 'select * table_name' 

a basic example of cron entry:

0 * * * * /usr/local/bin/mysql -u user -ppass -h 127.0.0.1 shop_database <<< 'select * customers' | mail -s 'customers export' 'email@example.org' 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -