MySQL root login email notification
There are multiple ways to go with this but using logs is the simplest way as there is no need of creating table inside mysql to log the root or user login with timestamp as mentioned in : http://www.fromdual.com/sites/default/files/logon_trigger_wp.pdf

I installed logtail and logcheck using yum, then wrote the following script and then created a cron job which runs this script:

#!/bin/sh

if [ -f foundadmin.txt ]
then
    rm foundadmin.txt
fi
if [ -f send.txt ]
then
    rm send.txt
fi

/usr/sbin/logtail2 -f /var/log/mysqld.log -o mysqld.log.offset | grep "root@localhost on  using Socket" > foundadmin.txt

if [ -s foundadmin.txt ]
then
    echo "Subject: MYSQLDB Admin Login on $(hostname)" > send.txt
    cat foundadmin.txt >> send.txt
    /bin/mailx -s "Subject: MySQLDB Admin Login on $(hostname)" myemail@com  &lt; send.txt
    rm foundadmin.txt
    rm send.txt
fi
exit 0

#

this is the cron job to make it run every minute:

This is run a cron job in a time interval and mail the admins to notify






cd /opt/mysql-check ; ./mysql-notify-script.sh