Professional Web Applications Themes

How to get a current session's host(ip and port of the client) and user name in a select - MySQL

I would like to know how to get the data from a 'select host, user from INFORMATION_SCHEMA.PROCESSLIST' for only the current session. Basically I'm trying to make a 'BEFORE INSERT ON' trigger that will fill in fcUser and fcHost (varchar) fields of a table with the inserter's username and host. I tried using the select above but it returns multiple rows for people with the process privilege. I looked around for a local variable but saw no host or user var. Did i just miss it? I'm using the 5.x line. Thanks, Tim...

  1. #1

    Default How to get a current session's host(ip and port of the client) and user name in a select

    I would like to know how to get the data from a 'select host, user
    from INFORMATION_SCHEMA.PROCESSLIST' for only the current session.

    Basically I'm trying to make a 'BEFORE INSERT ON' trigger that will
    fill in fcUser and fcHost (varchar) fields of a table with the
    inserter's username and host. I tried using the select above but it
    returns multiple rows for people with the process privilege. I looked
    around for a local variable but saw no host or user var. Did i just
    miss it?

    I'm using the 5.x line.
    Thanks,
    Tim

    gz.admin@gmail.com Guest

  2. #2

    Default Re: How to get a current session's host(ip and port of the client) and user name in a select

    >I would like to know how to get the data from a 'select host, user 

    select user();

    If you must have two fields, split the result at the ''.
     

    My MySQL doesn't seem to have a PROCESSLIST table. If yours does, you
    might find connection_id() useful.


    Gordon Guest

  3. #3

    Default Re: How to get a current session's host(ip and port of the client) and user name in a select

    On May 24, 5:45 pm, org (Gordon Burditt) wrote: 
    >
    > select user();
    >
    > If you must have two fields, split the result at the ''.


    >
    > My MySQL doesn't seem to have a PROCESSLIST table. If yours does, you
    > might find connection_id() useful.[/ref]

    Thanks! That solves it. I was looking for a variable but turns out to
    be a built-in function. Searching the mysql manual for connection_id()
    netted me '12.10.3. Information Functions'. Everything I needed.

    ty.
    t

    gz.admin@gmail.com Guest

Similar Threads

  1. Incoming port on remote host open?
    By Mark in forum Ubuntu
    Replies: 3
    Last Post: October 22nd, 04:47 PM
  2. Capturing the CLIENT host name
    By Aegis Kleais in forum Macromedia ColdFusion
    Replies: 0
    Last Post: May 25th, 08:03 PM
  3. Replies: 3
    Last Post: June 10th, 07:54 PM
  4. Start Menu - All Programs - All users/Current user (Default user)
    By Gary in forum Windows Setup, Administration & Security
    Replies: 2
    Last Post: August 11th, 05:52 AM
  5. Replies: 0
    Last Post: August 1st, 02:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139