I want to connect to a Google cloud SQL instance using its free IPv6 address instead of buying an IPv4 address. For that I looked up my IPv6 address and allowed it. I also looked up my routers IPv6 prefix and allowed that (afaik that should allow all pc in my home network to access the SQL instance).
The following code creates the problem:
$servername = "2001:6532:1234:1:6a4f:e1d7:5d69:52a3";
$username = "looooool";
$password = "superSecretStuff";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
And that code generates this error:
Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist unbekannt. in C:\Users\kjh\Documents\SF WEBSITE\appengine-try-php-master\connect_db.php on line 8
Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist unbekannt. in C:\Users\kjh\Documents\SF WEBSITE\appengine-try-php-master\connect_db.php on line 8
Connection failed: php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist unbekannt.
I'm sorry that the error message is in German, but I don't know where I would even change that. Also line 8 is the line with $conn = new mysqli($servername, $username, $password, $dbname);
on it. I've changed the IP adress so if it looks weird that is why. Hope you can help me.
If I get an IPv4 adress from Google it works without any problems.
This is a repost from here where I was told to reask it here, because it could be a problem with my ISP not assigning a persistent IPv6 address.
After I just wanted to look up my IPv6 address I noticed somethin strange. I went to wieistmeineip.de to look up my IPv6 address and at first it only showed my IPv6 address, then when I went to the speedtest my IPv6 address vanished, and I only have an IPv4 address since then. At least that is what all the ip address sites say. Also the same happend with google when you google "what is my ip address" google shows you your ip address, at first it showed my ipv6 and now it only shows ipv4.
My ISP: Kabel Deutschland
Now finnally my two questions:
Should the code above work given that I permitted my IPv6 address to access the cloud sql and that my ISP is not screwing me up?
Is there some way I could check if my ISP is doing something strange?
Update:
I tried to disable IPv4 completely on my machine (Windows) so I did that and restarted my computer. After the restart I did not get an IPv6 address from my router so I enabled IPv4 again, and I got an IPv4 address but no IPv6 address. I hope that helps.