技术解析
创建一个用于存放连接日记的数据和表.
creat database accesslog;
CREATE TABLE accesslog.accesslog(id
int(11)primary key auto_increment,time
timestamp,localname
varchar(30),matchname
varchar(30));
创建用户权限.
grant select on accesslog.* to root;
注意用户必须对accesslog表具有insert权限.
grant select on accesslog.* to [email protected]'%';
退出数据库或者重新开一个命令界面vi /etc /init.d /mysqld
注:在[mysqld]下添加以下这段话.
init-connect='insertinto accesslog.accesslog(id,time,localname,matchname)values(connection_id(),now(),user(),current_user());'
保存退出回到数据库.
select*from accesslog.accesslog where id= ;
show processlist;