1. Create DATABASE Auditdb
Use Auditdb
2. Create table Accesslog (ID int primary key Auto_increment,connectionid int,connuser varchar (), Matchuser varchar (30), Logintime datetime)
3. Ensure that all connected users have write access to this table
Insert into mysql.db (HOST,DB,USER,INSERT_PRIV) VALUES ('% ', ' auditdb ', ' ', ' Y ');
Flush Privileges
4, MY.CNF set Init-connect
Init-connect= ' Insert into Auditdb.accesslog (ConnectionID, Connuser, Matchuser, Logintime) VALUES (connection_id (), User (), Current_User (), now ()); '
5. Binlog must be opened
Log-bin=xxx
6. Restart
MySQL audit, for some special permissions users can not be audited, such as super,admin, and so on, rather than MAIRADB's powerful
This article is from the "DBSpace" blog, so be sure to keep this source http://dbspace.blog.51cto.com/6873717/1881053
MySQL Audit plugin settings