开发者

How to capture login audit information for a user logged into MySQL

开发者 https://www.devze.com 2023-04-12 03:07 出处:网络
How to find information (user/pass, IP address of the logged in user) regarding the users who connect to mysql (eithe开发者_开发知识库r programmatically via JDBC driver) or via the command line shell

How to find information (user/pass, IP address of the logged in user) regarding the users who connect to mysql (eithe开发者_开发知识库r programmatically via JDBC driver) or via the command line shell to perform a certain operation. Would like to know, if this information can be obtained via a SQL table.


MySQL does not directly give a method of tracking logins. However, the init_connect system variable can be set to a command to be executed when a new user logs in. You could make use of this to insert the values of USER() and NOW() into an auditing table.


SHOW PROCESSLIST might give you some of the information you required -> http://dev.mysql.com/doc/refman/5.1/en/show-processlist.html

Even better than that is the General Query Log -> http://dev.mysql.com/doc/refman/5.5/en/query-log.html

But its not enabled by default.....but can be logged to a table !

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号