Risposte:
Il comando per elencare tutti i trigger è:
show triggers;
oppure puoi accedere alla INFORMATION_SCHEMA
tabella direttamente da:
select trigger_schema, trigger_name, action_statement
from information_schema.triggers
TRIGGERS
tabella sono qui .SHOW TRIGGERS
richiede di avere i TRIGGER
privilegi per quel database e quella tabella. Se accedi a MySQL con un utente non privilegiato, l'esecuzione SHOW TRIGGERS
non restituirà nulla invece di generare un errore. Ciò può creare confusione se non si è a conoscenza dei requisiti di privilegio.
Spero che il codice seguente ti fornisca maggiori informazioni.
select * from information_schema.triggers where
information_schema.triggers.trigger_schema like '%your_db_name%'
Questo ti darà un totale di 22 colonne nella versione MySQL: 5.5.27 e sopra
TRIGGER_CATALOG
TRIGGER_SCHEMA
TRIGGER_NAME
EVENT_MANIPULATION
EVENT_OBJECT_CATALOG
EVENT_OBJECT_SCHEMA
EVENT_OBJECT_TABLE
ACTION_ORDER
ACTION_CONDITION
ACTION_STATEMENT
ACTION_ORIENTATION
ACTION_TIMING
ACTION_REFERENCE_OLD_TABLE
ACTION_REFERENCE_NEW_TABLE
ACTION_REFERENCE_OLD_ROW
ACTION_REFERENCE_NEW_ROW
CREATED
SQL_MODE
DEFINER
CHARACTER_SET_CLIENT
COLLATION_CONNECTION
DATABASE_COLLATION
LIKE
quando si tratta di schema. Ho lavorato in ambienti in cui farlo in questo modo sarebbe soggetto a errori in cui un cliente aveva un database denominato "company" e un altro denominato "company_project". Suggerirei anche di usare le maiuscole per PAROLE CHIAVE per chiarezza e INFORMATION_SCHEMA e le colonne lì, quindi è chiaro che non hai a che fare con un DB normale.