I am aware that when a connection is made to MySQL, MySQL does a reverse lookup on the IP address to determine the host it is coming from.

I have a very odd situation where I have a number of users connecting from the same server and some users are showing as coming from one host (lets say for example "myhost.com") and others are from a different host (lets say "myhost.co.uk")

The config of the connection in both cases is the same. The IP they connect from is the same. The server they connect to is the same. On both client and server PC the reverse lookup of the IP resolves to the same host (e.g. myhost.com). There is only one IP address on the server.

This is causing us problems with authentication because when adding new users (something which is an automated script) we add them using the server IP address as the host, and about 50% of the time, this is not working because when it does the reverse lookup it finds the wrong host name!

I am aware that you can turn off the host lookup in MySQL config, but at this stage I'm reluctant to do that and would rather find an answer to the problem.

  • Are there multiple entries in /etc/hosts on either the client or server for the client machine/IP?
    – Philᵀᴹ
    Mar 14, 2017 at 12:12
  • Hi, no, there are no entries on either server for the client IP
    – CRM Dev
    Mar 14, 2017 at 12:39
  • how many PTR records does that IP address have?
    – Jasen
    Apr 5, 2021 at 1:52

1 Answer 1


Adding the IP and host name to the hosts file on the database server seems to have resolved this problem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.