Things to Remember to Setup Remote Compute Engine MySQLGCP
This is not a how to, you can check the documentation, but more a dont forget post. This come from a Reddit thead than someone I helped.
I assumed you know how to install your MySQL and run a compute engine instance, here is the stuffs to think about,
- MySQL configuration has a listen set to 127.0.0.1 by default, set it to your IP, or 0.0.0.0
- MySQL user can be setup to localhost, grant all to 'user'@'%', or your IP instead of the %
- Create firewall rules for ingress and egress with the 3306 default MySQL port, with a network tag
- Modify your VM with this two network tag
- Setup the IP of the firewall rule to 0.0.0.0/0 (not recommended), or MYIP/32
- Activate and use private IP it's much more better way to connect your MySQL instance, it must be setup in the same VPC.
That's it, not much to say, but the checklist can save some time.