How to connect to MySQL Database (Remotely) without SSH Tunnelling?

  • Just acquired a Linode
  • Ubuntu build.
  • Installed MySQLServer

Other posts on the Community boards show that you should # out
bind-address=127.0.0.1

However this entry is non-existent in my my.cnf

What should I do to allow remote accesss without SSH tunnelling?

Thank you in advance

1 Reply

I used the following link to remotely connect to my database servers from my personal Mac.

https://stackoverflow.com/questions/8348506/grant-remote-access-of-mysql-database-from-any-ip-address

As for the "bind-address" entry, I had to edit the "/etc/mysql/mysql.conf.d/mysqld.cnf" file to comment out this line item.

vi /etc/mysql/mysql.conf.d/mysqld.cnf

I also suggest checking your firewall rules to ensure that there aren't any restrictions preventing you to connect to your database server. I needed to flush my rules and change them in order to connect.

You can backup your current firewall rules and flushing them afterwards. You can run the following commands to backup your current rules and flush them afterwards:

  iptables-save > /tmp/iptables.txt
  iptables -P INPUT ACCEPT
  iptables -P OUTPUT ACCEPT
  iptables -P FORWARD ACCEPT
  iptables -F

Once this is done, try establishing a connection to your database server. To restore your rules, you can run the following command:

 iptables-restore < /tmp/iptables.txt

If you are using UFW, you can disable this to verify if this is preventing a connection.

ufw disable

You can also add a rule for this using the following commands:

ufw enable
ufw allow mysql
ufw allow 3306

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