Pregunta

What I'm looking is to execute a script as soon as there is an INSERT on one of the MYSQL table.

I wanted to export all the contents of the inserted row into formatted Excel file. (This will be done through external script written in PHP)

Main issue is to call the script as soon as the insert occurs.

First thing that occurred to me is to create a Trigger and call the script (Found that this is not best approach. Other thing occurred to me is running a crontab

Could anyone please suggest if there is a better solution for this?

PS: The INSERT happens through an external application and I have no control over it.

¿Fue útil?

Solución

This question was answered here: Invoking a PHP script from a MySQL trigger btw.

Anyway, other possible solution is to create environment with replication (although there will be no slave), write your own mysql client connected to the master (simulating slave server) and waiting for commands comming through.

You can also create "tail -f" script listening on binlog file.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top