init_connect

init_connect + binlog 记录 mysql 操作日志

人走茶凉 提交于 2019-12-03 15:12:32
init_connect + binlog 记录 mysql 操作日志 简介 mysql 的 init_connect 变量是每个客户端连上数据库服务器时执行的一组数据,这组数据可以是一个或者多个sql语句。 A string to be executed by the server for each client that connects. The string consists of one or more SQL statements, separated by semicolon characters. mysql 的 binlog 日志用于记录所有更新了数据库内容的sql语句,以事件的形式保存。 The server's binary log consists of files containing “events” that describe modifications to database contents. 一、记录连接信息 创建表存放日志 CREATE DATABASE accesslog; CREATE TABLE accesslog.accesslog ( `id` INT (11) PRIMARY KEY auto_increment, `time` TIMESTAMP, `localname` VARCHAR (30), `matchname`