Trying to connect to hostB, I use the command below from hostA:
mysql --database=mydb --user=myuser --password=mypassword --host=hostB
As a response I get the message: ERROR 1045 (28000): Access denied for user 'myuser'@'x.x.x.x (IP of hostA)' (using password: YES)
When manually changing the host field on mysql.user on hostB to be the IP of hostA and flush privileges, I can do the remote access.
Why does hostB identifies hostA by its IP address and not by FQDN? I can ping hostA from hostB by FQDN and do reverse lookup.
I’ve set that kind of remote access many times, and never had any problem with this.