db/mysql

mysql get remote ip address

C/H 2015. 12. 22. 20:30

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


반응형

'db > mysql' 카테고리의 다른 글

MySQL UTF-8  (0) 2016.10.16
Ubuntu Mysql 5.7 upgrade  (0) 2016.06.09
특정사용자 table 권한 주기  (0) 2015.11.24
mysql multi count  (0) 2015.11.03
MySQL db selection Error - ERROR 1184 (08S01)  (0) 2015.05.25