How to open firewall to allow mysql server access from outsi

Hi there

I have a standalone mysql server and an 'app' server running php/apache. I've set this up according to the instructions set out here: http://library.linode.com/databases/mys … sql-server">http://library.linode.com/databases/mysql/standalone-mysql-server

However, since installing a firewall on the mysql server (using exactly the steps shown here: http://library.linode.com/securing-your … a-firewall">http://library.linode.com/securing-your-server#sph_creating-a-firewall) I can no longer access the mysql server from my app server.

Can anyone with iptables knowledge help me out?

Cheers

Jim

2 Replies

Add a rule like this -A INPUT -s <your app="" server="" ip="">/32 -p tcp -m tcp --dport 3306 -j ACCEPT</your> to your firewall config

Or you could tunnel traffic over an ssh session like this:

ssh -L 3306:localhost:3306 user@your.mysql.server.name

You would run this from the app server, and then set the app to connect to localhost for the database. Keep in mind that you would probably want some automatic way to re-establish the ssh session in case it gets closed.

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