Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.