Retrieve client ip address in mysql SELECT USER(); -- root@192.168.26.1 SELECT CURRENT_USER(); -- root@% select host from information_schema.processlist WHERE ID=connection_id(); -- 192.168.26.1:54755 select INET_ATON(LEFT(HOST, LOCATE(':', HOST)-1)) AS IP from information_schema.processlist WHERE ID=connection_id(); -- 3232242177