Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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.