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
Post a Comment