Allowing remote connections to mysqld

Hi,

I have a linode with 2 ips and a mysql server running but no matter what I try, I can't connect it from the outside, not even telnet it.

$ mysql -h 70.85.31.xxx -u test

ERROR 2003 (HY000): Can't connect to MySQL server on '70.85.31.xxx' (110)

$ telnet 70.85.31.xxx 3306

Trying 70.85.31.xxx…

telnet: connect to address 70.85.31.xxx: Connection timed out

telnet: Unable to connect to remote host: Connection timed out

$ telnet 67.18.186.xxx 3306

Trying 67.18.186.xxx…

telnet: connect to address 67.18.186.xxx: Connection timed out

telnet: Unable to connect to remote host: Connection timed out

My mysql server is working fine with connections from inside. I don't have 'skip-networking' in my my.cnf.

I'm using firehol for firewalling and is set to allow connections to port 3306. But even stopping firehol, it won't allow connections. Httpd, ftpd, sshd, etc.. are working just fine.

Anyone knows what the problem is?

Thanks.

3 Replies

Check the /etc/mysql/my.cnf file for the line starting with bind-address.

It's set to 127.0.0.1 by default, you need to change that to your public IP in order to connection from the outside world.

(May vary a bit depending on your version of mysql, distro, etc)

That did the trick :D

Thanks Boone!

I find it's easier (and gives me better peace-of-mind) to tunnel MySQL connections over SSH. That way, I don't have to open a new port (especially one so juicy a target), and I don't have to worry about configuring MySQL for either SSL or non-local networking. YMMV.

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