I'm looking for a way to run a MySQL procedure at database startup. I can only see sql triggers for MySQL. No database and user event triggers Are there other ways of doing this please? Thanks
I'm looking for a way to run a MySQL procedure at database startup. I can only see sql triggers for MySQL. No database and user event triggers Are there other ways of doing this please? Thanks
Basically you are right when you say that triggers cannot do that. However, it is possible to achieve this via other means.
For instance you could have a program or a script that would check whether MySQL is already running. In Ubuntu that would be
sudo service mysql status
If MySQL is not active, then start it and execute the script. In Ubuntu it would look like this
sudo service mysql start && yourpassword | mysql -u youruser -p -e "yourcode"
where yourcode would be the procedure call. Now, you need to make sure that: