Retrieve client ip address in mysql

后端 未结 4 1892
悲&欢浪女
悲&欢浪女 2020-12-05 14:28

I\'m trying to get with a simple SQL statement the IP address of the client. I do not want to use PHP or other techniques. Only pure SQL. When I use

SELECT          


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 14:40

    To get the IP address only without the port number.

    select SUBSTRING_INDEX(host,':',1) as 'ip' from information_schema.processlist WHERE ID=connection_id();

提交回复
热议问题