List:General Discussion« Previous MessageNext Message »
From:Steve Staples Date:March 3 2011 8:14pm
Subject:Re: Get MySQL server IP address in SQL
View as plain text  
On Thu, 2011-03-03 at 13:43 -0600, Chris W wrote:
> 
> On 3/2/2011 5:59 PM, Reindl Harald wrote:
> > Am 03.03.2011 00:31, schrieb Claudio Nanni:
> >> Anyone knows how to get the server* IP address* thru SQL?
> > no, because it is nonsense and has nothing to do with a db-server
> >
> > if you connect via tcp you know the ip
> >
> 
> Isn't that kind of like going to someones home, knocking on their door, 
> and asking, "Where do you live?"
> 
> Chris W
> 

What if this is a "load balanced" cluster?  Doesn't that setup query
"serverA", and in turn, "serverA" finds the least busiest server in the
"cluster", which could be "serverY", therefore you would have no idea
which server the query was run on?

But, as far as I can tell, you could only get the "server_id" (which
would have to be unique anyway in the cluster), so you could just add
this to the query:
SELECT @@global.server_id

Then you can figure out elsewhere what 'server_id' corresponds to what
server ip address.

Just trying to think of other solutions on why the OP would want this
data...

Steve



Thread
Get MySQL server IP address in SQLClaudio Nanni3 Mar
  • Re: Get MySQL server IP address in SQLReindl Harald3 Mar
    • Re: Get MySQL server IP address in SQLChris W3 Mar
      • Re: Get MySQL server IP address in SQLSteve Staples3 Mar
        • Re: Get MySQL server IP address in SQLClaudio Nanni3 Mar
          • RE: Get MySQL server IP address in SQLJerry Schwartz3 Mar
            • Re: Get MySQL server IP address in SQLClaudio Nanni3 Mar