I've searched for this issue but couldn't get any solution working from the client side.
We've mysql server with Apache on Ubuntu.
Our client (MacOS) is getting "can't get hostname for your address" error when connecting to our database. He is able to connect without any problems from Home network but not from his work network.
None of our other clients face this issue so I guess there is no problem on server side. Solutions like editing my.ini or my.cnf is not what we're looking for as server side changes are not encouraged. Any help towards solving this problem will be appreciated.
Server: mysql (Apache,Ubuntu)
Client: macOS
When you say the client in question
then I assume it will get assigned a different IP address when connected to the office network versus when connected via VPN from home.
Getting a hostname for an address is nothing but reverse DNS, i.e. first of all, find out which IP address the machine is assigned in the office network and in the home network, see: https://apple.stackexchange.com/questions/20547/how-do-i-find-my-ip-address-from-the-command-line.
Then try an
using either address and check if a hostname is being reported or not. I'd bet in case of the office network, it will come back with NXDOMAIN.
Then the next question is why. That means you will have to check how IP is resolved to names on your network. This can either be a local hosts file or some DHCP/DNS server on your network which doesn't know the name for an IP it's given out.
In my case, I try everything available on the Internet but nothing works for me. So I try to solve this problem by changing the name of the computer (B2 to BBB), which changes the numeric value from the Hostname of a computer and finally my problem is solved.