I'm trying use a host restricted MySQL user when connecting from one Amazon EC2 instance to another. I wanted to use elastic ip address for their dns function, but you can probably ignore the Amazon EC2 references in this question.
I think my question is how to define the dns name of the mysql client by the client when the connecting as a user to mysql?
I apologise if I have problem wrong. Perhaps it is more generic - how do define local machines host name for use with any outgoing connection?
The problem is the client app has two dns names but I need to to use the other. The details are:
Public
db.fixedip.amazonaws.com app.fixedip.amazonaws.com
-------------------------------------------------------------------------------
Internal
db.randomdns.ec2.internal app.randomdns.ec2.internal
Actual machine instance
MySQL on Linux App on Windows 2003
'user'@'app.fixedip.amazonaws.com'
From app
mysql -uuser -p -hdb.fixedip.amazonaws.com
ERROR 1130 (HY000): Host 'app.randomdns.ec2.internal' is not allowed to connect to this MySQL server
db.fixedip.amazonaws.com conveniently resolves to the internal IP address (which can change) but the MySQL client isn't identified as its non-random app.fixedip.amazonaws.com public dns name.
This doesn't seem to work :)
mysql [email protected] -p -hdb.fixedip.amazonaws.com
UPDATE: The current answer redefines the problem - don't bother with hosts in mysql and use alternative host restriction. I'll accept that unless anyone else would like to comment on the original question