Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

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

When using triggers, if an update is done to a table then a trigger is executed. This is very convenient. But what I would need is to execute an external script.
Is it possible to configure MySQL somehow so on a trigger/change of a value in a table an external process/scrip is executed?

share|improve this question
So for every row update, an external application would be called? And if 4000 rows are updated, the application would be launched 4000 times? You think that would be wise? And if you had a million rows updated? – ypercubeᵀᴹ Jan 19 '14 at 1:28
Even if the update frequency is low, there are several other serious issues with such an approach. See: Catch-22 of the Active Database – ypercubeᵀᴹ Jan 19 '14 at 1:39
@ypercube:Interesting link.It is based on "triggers fire at the time of the operation, not the time of the commit". I was not aware of that.In this case it seems that triggers are useless in any case – Jim Jan 19 '14 at 12:51
As simple example, I found this blog with an simple example: Call an external program form MySQL Trigger I found this example easy to understand. :) Best regards. – iVieL Jul 31 '14 at 20:13
up vote 1 down vote accepted

It is possible, and it also makes for a security threat.

Anyway, to make that happen you would need to create (program, compile and install plugin) you own UDF - User Defined Function. It's a C/C++ code, so you can do anything you like in there.

share|improve this answer
Hi Shlomi, could I persuade you to elaborate on how UDF can make a security threat? – Morten Apr 14 at 7:09
@Morten I'll give you the extreme. Suppose the UDF call is this: SELECT EXECUTE_ON_BOX('rm -rf /important/data') and the UDF just accepts given string and executes it. – Shlomi Noach Apr 17 at 7:59

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.