is there a way to execute a MySQL procedure automatically after server is up

I need to run a MySQL command every time the MYSQL server is up
I search for a start-up event or hooks but didn’t find anything,
anyone knows the way to do it?

Answer

MySQL Server supports a configuration file directive init_file.

this variable names a file containing SQL statements to be read and executed during the startup process.

Basically, it’s like your .bash_profile is for Bash shell instances. In that it contains commands that are executed once at the startup.

For example using init_file is required for enabling performance_schema instruments and consumers at startup, because that must be done with UPDATE statements at runtime, not with configuration file directives.

Leave a Reply

Your email address will not be published. Required fields are marked *