"danson" <danwatts> wrote:SELECT USER()> Looking to write a script such as:
> select * from domains where hostname=MYSQL.CLIENT.HOSTNAME
> that dynamically matches against the hostname (or at least IP) of the
> connecting server and returns the appropriate matching rows.
> Is this possible?
shows you what user and host was used to establish your current
connection to the database. So the host part is
SELECT SUBSTRING_INDEX(USER(), '', -1)
By default mysqld tries to lookup IP numbers but you may configure
either mysqld or your hostsystem to not use reverse lookups. Then
you will get a numerical host address.
Axel Schwenke, Senior Software Developer, MySQL AB
Online User Manual: [url]http://dev.mysql.com/doc/refman/5.0/en/[/url]
MySQL User Forums: [url]http://forums.mysql.com/[/url]