I have a MySQL database with a few tables and triggers. A process was trying to drop one of the triggers and it failed with the following error:
Malformed file type header in file 'trigger_name.TRN'
I tried to drop the trigger manually, but obviously got the same error. So I went ahead and deleted the
.TRN file itself (was that a bad idea?).
After deleting the
.TRN file, the trigger still appears in
information_schema.TRIGGERS. If I try to drop it I get error "Trigger does not exist". If I try to create another trigger with the same name, table and event manipulation I get error "Trigger already exists".
I don't know what else to do. How can I really delete this trigger so that it can be created again?
MySQL version is 5.0.22 and all tables are MyISAM.
SHOW CREATE TABLE outputs:
CREATE TABLE `cash_operation` ( `id` int(11) NOT NULL auto_increment, `amount` decimal(16,8) NOT NULL default '0.00000000', `comment` varchar(500) NOT NULL default '', `reason_id` int(11) NOT NULL default '-1', `date` datetime NOT NULL default '1980-01-01 00:00:00', `reconciliation_number` int(11) NOT NULL default '-1', `reason_desc` varchar(250) NOT NULL default '', `automatic` tinyint(1) NOT NULL default '0', `employee_id` int(11) NOT NULL default '-1', `employee_code` varchar(250) NOT NULL default '', `employee_name` varchar(250) NOT NULL default '', `payed_employee_id` int(11) NOT NULL default '-1', PRIMARY KEY (`id`), KEY `cash_operation_reason_id` USING BTREE (`reason_id`), KEY `cash_operation_reconciliation_number` USING BTREE (`reconciliation_number`), KEY `cash_operation_automatic` USING BTREE (`automatic`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8
SELECT @@global.datadir; results in error "Unkown system variable 'datadir'"