mysql audit-访问日志记录

设置init-connect

创建数据库
create database accesslog;
create table accesslog.accesslog (`id` int(11) primary key auto_increment,`time` timestamp,`localname` varchar(30),`matchname` varchar (30))

授权用户
grant read on accesslog.* to root@'%' identified by '1qazxsw';

设置init-connect
[mysqld]
init-connect='insert into accesslog.accesslog values(connection_id(),user(),current_user(),now());'

你可能感兴趣的:(数据库,database,primary,identified,30)