1

I'm trying to make a small database I can use to log changes I make to configuration files on various Linux systems.

My thought was have a Database named for the system, and then a table called ConfigFiles that has an ID column, a FileName column and a FilePath column, to act as an index of all the entries. The ID is an Int and the FileName and FilePath columns are varchars

I then wanted to have a Trigger set so whenever I insert a row into ConfigFiles, a new table would be created, with the name , which would contain an ID column, a ConfigOption Column, and a ConfiguredValue column.

When I went to set up the trigger in PHPMyAdmin, however, I am given the error "Explicit or implicit commit is not allowed in stored function or trigger."

My SQL looks like this:

CREATE TABLE IF NOT EXISTS new.filename (
`id` int(11) NOT NULL auto_increment,
`ConfigOption` varchar(25) NOT NULL,
`ConfiguredValue` varchar(150) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ConfigOption` (`ConfigOption`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

with the Table set to ConfigFiles, the Time set to AFTER, and the Event set to INSERT.

So what am I doing wrong, and what should I be doing if I want to achieve the above?

Thanks in advance for any help offered!

N.B In case you're looking at me like "What a terrible idea!", this isn't a production sort of thing for use in anything business critical, this is literally just so when I configure things on my own computers, which is usually while messing with new software to learn how it works, I can basically keep a journal of the things I do. A database seemed more searchable and better to store key-value pairs than keeping a bunch of text files. And it's a good excuse to get more familiar with SQL

FreelancerJ
  • 111
  • 1

0 Answers0