Remotely login to mysql

So I've set up mysql using the following instructions… https://library.linode.com/hosting-website and I downloaded MySQL Workbench. I am able to login through command prompt, but it doesn't let me login remotely. I get an error saying "Failed to Connect to MySQL at ip.address.here with user username". I know when I had a shared hosting site, I had to white list my computer's address, is that true for this too? How would I go about doing that?

5 Replies

Set up an ssh secure tunnel to your Linode. Then connect MySql Workbench to localhost:3306 if that's the local port you decide to setup your tunnel for.

When you setup your connection in Workbench did you change the "Connection Method" to "Standard TCP/IP over SSH?"

Give that a try and see if it works. You'll look like you are connecting locally to the MySQL server and you will never have to worry about white listing anything other than localhost. Then you can stop 3306 connections from coming through the firewall and bind MySQL only to localhost on the server.

If you did that already, did you set the "MySQL Hostname" to "localhost" or "127.0.0.1?" in the connection setup?

I got it working… yeah I wasn't using the "over SSH" option. When I do it over SSH it worked fine.

Are there any drawbacks doing it threw SSH though?

No drawbacks that I know of (doesn't mean there aren't any). The big plus is security, no worries about someone guessing your database password and compromising everything because they have to be logged in via SSH first to access MySQL. I use SSH keys as well to make sure there is no way to log in via SSH without my key.

Exposing MySQL to the world basically exposed my entire server because everything was stored in there.

Just the normal overhead of an encrypted session. Since Mysql management is all text, and not that much of it, you'll probably never notice.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct