Skip to content

Remote connection to MySQL from my local computer #736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sebastianpd1 opened this issue Aug 15, 2019 · 8 comments
Closed

Remote connection to MySQL from my local computer #736

sebastianpd1 opened this issue Aug 15, 2019 · 8 comments
Labels
meta: stale This issue/PR is stale and will be closed soon type: question reporter has a general question

Comments

@sebastianpd1
Copy link

Hello, I'm using a gitpod container to run a database, is it possible to connect using something like SequelPro or MySQL workbench??

This is my connection string inside gitpod:

mysql://root@localhost/example
@jankeromnes jankeromnes added the type: question reporter has a general question label Aug 16, 2019
@jankeromnes
Copy link
Contributor

Hi @sebastianpd1, thanks for your interesting question!

This use case would also be useful for our dedicated gitpod/workspace-mysql image.

I have no experience with SequelPro or MySQL Workbench, but I'd say that you have two options:

  • Install one of these inside your Gitpod container, and have it connect to the local MySQL
  • Expose the MySQL port (by adding - port: 3306 to your .gitpod.yml, in the ports section) and run the following command in a Gitpod terminal to know the external connection string:
echo "mysql://root@$(gp url 3306 | sed 's_https://__')/example"

I haven't tested this yet. Please let me know if you're able to get it to work, or if you'd like further help. 🙂 Good luck!

@kunxin-chor
Copy link

kunxin-chor commented Apr 9, 2020

Hi,

I have tried generating the connection string via the method above, and it doesn't seem to work. Here's my sample connection string:

mysql://remote@3306-b56c270d-9f91-4154-a6ac-df568bdee40c.ws-us02.gitpod.io:3306/test

I keep getting a timed out error, using DBeaver. I have make sure to create the remote user and the test database. The port 3306 is also public.

@beyerph
Copy link

beyerph commented Jul 13, 2020

Same Problem here .. any News about Connecting to the remote MySQL-Database with Sequel Pro?
Monosnap 2020-07-13 14-09-46

@geropl
Copy link
Member

geropl commented Jul 13, 2020

mysql://remote@3306-b56c270d-9f91-4154-a6ac-df568bdee40c.ws-us02.gitpod.io:3306/test

The problem here is that Gitpod supports only HTTP traffic into workspaces atm. There might still be a way (by proxying mysql/socket over HTTP) but that's a tad more work I guess.

@jankeromnes
Copy link
Contributor

jankeromnes commented Jul 15, 2020

Note: I know that this doesn't really address the issue here, but if you need a graphical MySQL Client, there are several MySQL extensions available in Gitpod (to install them, simply find the Extensions panel in the IDE's left vertical menu, and search for "mysql").

I've never tried to use them, but I know we install the "VSCode Database" extension in some of our repos.

@aslafy-z
Copy link
Contributor

aslafy-z commented Jul 15, 2020

Here are two ways of achieving what you want.

Use ngrok - only server needed

  • Signup at https://ngrok.com/signup
  • Copy authtoken from https://dashboard.ngrok.com/auth/your-authtoken
  • Install ngrok in your GitPod workspace
     wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && unzip ngrok-stable-linux-amd64.zip && rm ngrok-stable-linux-amd64.zip
  • Register your authtoken
    ./ngrok authtoken "YOUR-AUTH-TOKEN"
  • Forward mysql TCP port
    ./ngrok tcp 3306
  • Use the given hostname to connect to your mysql instance running inside GitPod from your local workstation

Use inlets - client / server needed

You can use follow this tutorial to expose services. https://www.gitpod.io/blog/local-services-in-gitpod/

@stale
Copy link

stale bot commented Oct 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@akosyakov
Copy link
Member

We just announced preview version of Gitpod local companion which allows to tunnel any tcp port: https://www.gitpod.io/blog/local-app particularly it allows you access everything on localhost on proper port, similarly how you will do it in the local env, please try and give us feedback 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: stale This issue/PR is stale and will be closed soon type: question reporter has a general question
Projects
None yet
Development

No branches or pull requests

7 participants