Score:0

Connecting to MySQL on GCP CE instance (WordPress)

bt flag

I installed WordPress from the Google Cloud Marketplace into a Compute Engine instance, and am trying to connect to the MySQL instance on that machine using DataGrip on my local machine (macOS).

I can connect in the SSH terminal, so I know the instance is up and running and the credentials are correct.

I have opened the port (3306) on both ingress and egress on the VM and I have the external IP. However, I variously get "Connection refused" (DataGrip) and other errors trying to connect.

Are there any special considerations when trying to do this?

Score:1
cn flag
  1. Do not create an egress firewall rule unless you know exactly why. Delete that rule. The default rule should be enabled allowing all egress traffic.

  2. The default installation of MySQL does not listen on public network interfaces. Only internal connections are allowed. In mysql.conf change the bind-address to 0.0.0.0. Then run systemctl restart mysql.

serlingpa avatar
bt flag
Thanks, I'll do that, but why the seeming urgency around disabling egress? Isn't it just preventing my VM making contact with the outside?
John Hanley avatar
cn flag
@serlingpa - MySQL does not normally initiate contact with the Internet but other processes do in the cloud. Restricting egress is the fast way to break VMs. Therefore unless you understand what traffic you are managing and which traffic is necessary, allow all egress traffic. Another reason is that multiple changes that do not solve the actual problem can introduce future problems to solve.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.