Is there a way to create a trigger in mysql without hardcoding the database name?
Doing a typical create trigger will stop working if I dump the database and then import it into a database of a different name.
This question came from our site for professional system and network administrators.
I guess I'll guess an answer to my question. A lot of mysql documentation just references a table name without specifying a database, so I am assuming the database is optional and if you don't include it, mysql will use the current one. | |||||
|
If you mysqldump a table with
the code for the trigger definition is included. However, there is a hardcoding situation you want to be cognizant of
If you mysqldump Therefore, please keep aware of all hardcoding situations inside and outside of your triggers. | |||
|