Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access MySQL server remotely

I install mysql manually by sshing the virtual disk of google compute engine . I already create user by following this mysql-adding-user-for-remote-access and I bind address = 0.0.0.0 then restart mysql service, when I connect remotely using external ip address and the created user it doesn't work. How can I connect I am using HeidiSQL mysql client tool.

Thank you in advance.

like image 712
jemz Avatar asked Jan 23 '26 14:01

jemz


2 Answers

By default - the mysql port is closed on google cloud platform. If you want to allow external access you should open that port in the firewall.

To do so you can run (using gcloud):

    $ gcloud compute firewall-rules create "mysql-remote-access" --allow tcp:3306 --source-tags "mysql-client" --target-tags "mysql-server"

(Or use the CONSOLE for that: https://console.cloud.google.com/firewalls/add?_ga=1.140859190.569287361.1481048942 )

Note that you will also need to create a user (in mysql) that has access privileges from your own IP, and set this user privileges to allow access to the database you are using).

like image 79
Dekel Avatar answered Jan 25 '26 04:01

Dekel


In my case, I had to also open the firewall within Windows in addition to opening the port using Google VPC networking.

Make sure both boxes (public and private) are checked next to MySQL 57 in the Windows Firewall app.

enter image description here

like image 40
Ben Wilson Avatar answered Jan 25 '26 04:01

Ben Wilson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!