0

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?

serlingpa
  • 109
  • 2

1 Answers1

1
  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.

John Hanley
  • 4,754
  • 1
  • 11
  • 21
  • 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? – serlingpa May 23 '23 at 07:59
  • @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. – John Hanley May 23 '23 at 15:08