mysql> GRANT ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE USER, CREATE VIEW, DELETE, DROP,
EXECUTE, FILE, INDEX, INSERT, LOCK TABLES, PROCESS, REFERENCES, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE,
SELECT, SHOW DATABASES, SHOW VIEW, SHUTDOWN, UPDATE ON *.* TO 'foo'@'x.x.x.1' IDENTIFIED BY 'bar';
The following command will start the connection logging.
mysql> SET GLOBAL init_connect='create table if not exists test.connect(db_name varchar(100), user_with_ip varchar(100),
user_permission varchar(100), connect_id varchar(100), connect_time datetime);
insert into test.connect select @@hostname as db_name, user() as user_with_ip, current_user() as user_permission, connection_id() as connect_id, now() as connect_time';
We can check if the initialization script is active.
mysql> show variables like '%connect%';
to see more about the init_connect give below is the urls:
http://planet.mysql.com/entry/?id=26710

No comments:
Post a Comment