Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically I want to create a trigger so that when a field is updated it kicks off a local bash script (or python...whatever) to kick off a workflow (emails, work requests, etc). Is it possible to execute local system scripts/executables from mysql SQL? My google searches have been unsuccessful.


share|improve this question
Check this stackoverflow answer: – hmontoliu Feb 27 '12 at 15:39

It seems not easy to do it. I think it will be better to do it at the application level if at all possible. You can also query your table for updated rows every x minutes and then execute the script in a cron job.

share|improve this answer
To recognize the updated rows easily, you can add a new column updated that should be set to 1 to indicate the updated rows. A trigger after update will set this flag to 1 and your script will clear it. – Khaled Feb 27 '12 at 15:44
Just default the column to 1 instead of abusing a trigger for this. – adaptr Feb 27 '12 at 16:22

As already suggested, a once-per-minute cron job that queries a table with pending tasks is the better solution here.

You won't be calling potentially privileged OS code from a database server, and the control over task execution remains firmly in the hands of your application(s).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.