FYI, If you only want the hostname, and not the user, combine the USER() with a SUBSTRING_INDEX():
SUBSTRING_INDEX(USER(),'@',-1) --> returns host only SUBSTRING_INDEX(USER(),'@',1) --> returns username only USER(), SESSION_USER(), and SYSTEM_USER() are all synonymous CURRENT_USER() however is different in that it returns the username and hostname that the current session was authenticated as. I too am unaware of how to prevent the truncation of string. If anyone knows, I myself would be very interested. Thanks, -Mark --- Chris Faust <[EMAIL PROTECTED]> wrote: > That is good to know Emery.. > > I think I'll be ok in that respects, I did the > permissions so the granted > host is by IP (ex 192.168.0.%), so I'm getting IP > back and I'm using the > same username for all and its not truncated - so I > think I'm good to go!! > > I just my first test on my dev server and everything > worked exactly as I > hoped! > > Thanks > -Chris > > ----- Original Message ----- > From: "Director General: NEFACOMP" <[EMAIL PROTECTED]> > To: "Chris Faust" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Monday, October 20, 2003 9:48 AM > Subject: Re: Getting remote connected machine as > value in a select. > > > > You are welcome. > > But remember that sometimes it truncates the name. > > For example I sometimes connect from my laptop > using nzeyimana as username > > and it just returns [EMAIL PROTECTED] instead of > returning > > [EMAIL PROTECTED] > > (it just removes the last P). > > > > I don't know why. Maybe someone on the list may > help on this issue. > > Also as I told you, I don't know the difference > between USER() and > > SESSION_USER() > > > > > > Thanks > > Emery > > ----- Original Message ----- > > From: "Chris Faust" <[EMAIL PROTECTED]> > > To: "Director General: NEFACOMP" > <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > > Sent: Monday, October 20, 2003 15:27 > > Subject: Re: Getting remote connected machine as > value in a select. > > > > > > > Thanks Emery, > > > > > > That is exactly what I needed, it gives me back > the IP of the machine > I'm > > > connecting from. > > > This is going to allow me to remove so much > machine specific code that > we > > > could put up a new server within mins if needed. > > > > > > Thanks Again > > > -Chris > > > > > > ----- Original Message ----- > > > From: "Director General: NEFACOMP" > <[EMAIL PROTECTED]> > > > To: "Chris Faust" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > > > Sent: Monday, October 20, 2003 4:38 AM > > > Subject: Re: Getting remote connected machine as > value in a select. > > > > > > > > > > I don't know I well understand your problem. > > > > There is a function SESSION_USER() in MySQL > that returns the currently > > > > connected user. The user string also returns > the host from which he > > > > connected in the form [EMAIL PROTECTED] > > > > > > > > So, by issuing the query: > > > > SELECT SESSION_USER(), Table.* from Table > > > > you will get the needed data. > > > > > > > > But the problem is that you will need to get > the host name from that > > > > username. Also it truncates the string when it > is long > > > > There is also USER() that returns the same > [EMAIL PROTECTED] . I really don't > > know > > > > the real difference between the two functions. > > > > > > > > > > > > Hope this helps > > > > > > > > > > > > Thanks > > > > Emery > > > > ----- Original Message ----- > > > > From: "Chris Faust" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Sunday, October 19, 2003 23:55 > > > > Subject: Getting remote connected machine as > value in a select. > > > > > > > > > > > > Hello, > > > > > > > > I'm curious as to if something is possible - I > don't know if its > > possible > > > to > > > > explain it right. > > > > > > > > I have a table which contains a bunch machine > specific information, > file > > > > paths, names etc. > > > > > > > > What I would like to try and accomplish is > when I query this table for > > the > > > > information I need, I also receive back a > value (that I can define) > that > > > is > > > > determined by the identity of the machine > making the query - either by > > IP > > > > address or whatever. > > > > > > > > For an example say I have 3 machines total. > > > > 1 mySQL DB Server > > > > 2 web servers > > > > > > > > When I connect to mySQL from either of the 2 > web servers and say > > something > > > > like "Select * from table", one of the values > returned would be > > something > > > > like "web1" as that is what I defined to be > the value for when machine > > > > 192.168.0.4 connected to it. > > > > It doesn't have to be IP, I'm just using that > for a example. > > > > > > > > Any ideas on how to accomplish something like > this? > > > > mySql 4.0 > > > > RH 9 > > > > > > > > Thanks > > > > -Chris > > > > > > > > > > > > > > > > > > > > -- > > > MySQL General Mailing List > > > For list archives: http://lists.mysql.com/mysql > > > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]