snipt

Ctrl+h for KB shortcuts

Text only

Allow Remote DB connections on port 3306 for WHM

1
2
3
4
5
6
7
8
Answer From http://forums.cpanel.net/f354/whm-server-not-allowing-remote-db-connection-408421.html

WHM Server Not Allowing Remote DB Connection
I'm having trouble figuring out why our web server won't connect to Amazon RDS. I've connected via command line on a simple CentOS server and from several computers via MySQL Workbench. The RDS security groups are set up properly. The command I'm using should otherwise work. Is it possible my server is blocking outgoing connections to port 3306 and where would I change this?

- - - Updated - - -

Never mind. I should have known it would be in CSF. For anyone else who is up late at night after working all day and have a tired brain, WHM->ConfigServer Firewall->Firewall Configuration->All Outgoing TCP Ports, add 3306. Good night.
https://snipt.net/embed/0cd265948407cb5555c40af9a2f15e5f/
/raw/0cd265948407cb5555c40af9a2f15e5f/
0cd265948407cb5555c40af9a2f15e5f
text
Text only
8
2019-05-23T18:03:28
True
False
False
Dec 31, 2014 at 12:57 PM
/api/public/snipt/137743/
allow-remote-db-connections-on-port-3306-for-whm-ba238b79
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Answer From http://forums.cpanel.net/f354/whm-server-not-allowing-remote-db-connection-408421.html </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>WHM Server Not Allowing Remote DB Connection </span><span id="L-4"><a name="L-4"></a>I&#39;m having trouble figuring out why our web server won&#39;t connect to Amazon RDS. I&#39;ve connected via command line on a simple CentOS server and from several computers via MySQL Workbench. The RDS security groups are set up properly. The command I&#39;m using should otherwise work. Is it possible my server is blocking outgoing connections to port 3306 and where would I change this? </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>- - - Updated - - - </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a>Never mind. I should have known it would be in CSF. For anyone else who is up late at night after working all day and have a tired brain, WHM-&gt;ConfigServer Firewall-&gt;Firewall Configuration-&gt;All Outgoing TCP Ports, add 3306. Good night. </span></pre></div> </td></tr></table>
"port 3306", "remote database", "remote db", 3306, cpanel, database, whm

Bash

Block MySQL port for everyone except localhost and a single IP

1
2
3
iptables -A INPUT -i lo -p tcp --dport mysql -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport mysql -s 123.123.123.123 -j ACCEPT
iptables -A INPUT -p tcp --dport mysql -j DROP
https://snipt.net/embed/ece3362f17246adf5af553c7ccaca042/
/raw/ece3362f17246adf5af553c7ccaca042/
ece3362f17246adf5af553c7ccaca042
bash
Bash
3
2019-05-23T21:02:20
True
False
False
/api/public/snipt/33768/
block-mysql-port-for-everyone-except-localhost-and-a-single-ip
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>iptables -A INPUT -i lo -p tcp --dport mysql -j ACCEPT </span><span id="L-2"><a name="L-2"></a>iptables -A INPUT -i eth0 -p tcp --dport mysql -s 123.123.123.123 -j ACCEPT </span><span id="L-3"><a name="L-3"></a>iptables -A INPUT -p tcp --dport mysql -j DROP </span></pre></div> </td></tr></table>
3306, bash, iptables, mysql, server