Connecting to Google Cloud SQL using IPV6
TL;DR : Create Cloud SQL instance, add your/your server’s IP in ‘Allowed Networks’, Create a new user account in ‘Access Control > Users’, Connect!
I recently decided to step into 2012, and stop living in the 1980's by switching to IPv6, primarily because Google Cloud would charge me about $7 per month for an IPv4 address on a Cloud SQL instance.
But it wasn’t without issues, so here’s how I solved it:
- Create your Cloud SQL instance.
- Go into the Access Control panel.
3. Add your IP to allowed networks, give it a name, hit save.(To allow all networks, you can ‘ ::/0’, which is the equivalent of 0.0.0.0/0 in IPv4)
Tip : To find your own address, you can Google ‘What is my ip address’, and good guy Google will show you your IPv6 address.
4. Go to users, Add a new user, give it a username, password, and addresses that can access your network.
This is the important step, since the default root users have 127.0.0.1, ::/1, and localhost as allowed hostnames, thus stopping you from accessing your instance with all the IPv6 goodness from an external network.
That’s all there is to it, let’s try connecting to it to see if it worked. (For this example we’ll be using MySQL workbench to test access, steps should be the same for any client.)