Skip to main content

how know IP/HOSTS of connections in last 30 minutes?

Comments

1 comment

  • MilesWeb

    There are no built-in commands in MySQL or Linux for monitoring recent connections. You can monitor information_schema. processes or create a logging chain in iptables to accomplish this. The pertinent IP addresses can then be saved into a table by utilising a MySQL event or a PHP cronjob.

    Refer to the below article to enable the logs :

    First, you have to enable the general query log http://dev.mysql.com/doc/refman/5.5/en/query-log.html

     

    After that, you can see every connection and the queries that were used. Please use this log carefully as it can get large.

     

    Here's an example of one of my recent connections to my local server as root.

    101208 10:55:18      5667 Connect  root@localhost on 
                         5667 Query select @@version_comment limit 1
    101208 10:55:26      5667 Query show databases
    0

Please sign in to leave a comment.