0

How to get mail from mysql, if directly root or someone editing or updating to particular database it should trigger a mail and log the edit.

I have tried Triggers but its not working,

Server specifications:

   OS : ubuntu 10.04 64bit
   mysql : mysql server 5.1.41

I was just wondering if anyone could help me with this problem I'm having. I would really appreciate it.

1 Answer 1

1

im doing now similar project with this topic.

My solution for this woud be:

edit:

/etc/mysql/my.cnf
log = /var/log/mysql/mysql.log

that write some perl function:

#!/usr/bin/perl 
use strict;
use warnings;
use File::Tail;
my $name=' /var/log/mysql/mysql.log';
my $file=File::Tail->new(name=>$name,
                        interval=>1,
                        maxinterval=>15,
                        adjustafter=>5,
                        ignore_nonexistant=>1,
                        reset_tail=>1,
                        reset_after=>35,
                        tail=>0
                        );

my $line='';
while ( defined ($line=$file->read)) {
      if ($line =~ /Update/){exec `mail -s $subj < $line`}
}

You should to add functioality for this

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .