Finding Record Between Two IP Addresses on MySQL Tables, Can You Do it?

mysql inet_aton('ip_address')
Written by @kiosmerdeka

MySQL function INET_ATON(‘ip_address’)

Converting IP Address to Big Integer.

One sample of use:

Find out does user “faras1” logged in within 192.168.1.111 – 192.168.1.124 on the local network?

SELECT id, user_id, user_name, user_ip, message, `action`, created_at, updated_at FROM logs WHERE INET_ATON(user_ip) BETWEEN INET_ATON('192.168.1.111') AND INET_ATON('192.168.1.124') AND user_name='faras1';

Result :

mysql inet_aton('ip_address')

Baca juga  Nvidia GT-730 With Very High Fan Speed on Ubuntu 18.04

Leave a Comment