IP protocol used by MyDac TMyconnection changes from IPv4 to IPv6 (or vice versa) and database queries fail

IP protocol used by MyDac TMyconnection changes from IPv4 to IPv6 (or vice versa) and database queries fail

Scenario
My application obtains the public IP address of the user by running a small PHP script on the same server that hosts my database. I then programatically insert that IP address into the remote hosts table so that I can gain remote access to the DB to run queries etc on port 3306.

When I get my IP address it may return as IPv4 or IPv6, depending on the whims of the server. I store the IP address I get, test the connection by setting TMyconnection to true - which works OK  and disconnect again. Later,  when I use TMyquery to run a query against the database I reconnect, or let the query do that, and run the query. 
 (I do have the means to get my IP address as definitely IPv4 so I could standardise on IPv4 and always store that in the remote hosts.

The problem:
Assume I have an IPv4 address stored in the remote hosts table (in the form 185.83.68.71) and the test connection passed.
Sometimes, but not always, when the application later runs a query, it gets an error back from the database along the lines of " Connection Error :#28000Access denied for user 'myuser'@'2a0c:5c86:8220:1:8905:f958:d2f8:368d' (using password: YES) i.e. the TMyconnection is now trying to reach the database using my user's  IPv6 IP address. This of course fails as that address is not in the remote hosts.

I have also had the opposite. the application stores an IPv6 address and tests the connection OK but TMyConnection later uses an IPv4 address, which fails as the IPv4 address is not in the remote hosts table.

Question.
(1) Does TMyconnection itself get the user's IP address from somewhere every time it connects, which might be returned as a different protocol to the one the application obtained? If not how does it know which protocol, IPv4 or IPv6, to use for the connection? 
(2) Is there a way to force TMyconnection to always use IPv4? Then my application can always obtain the user's IP address in IPv4 and always store an address that matches the one TMyConnection will use.