Greetings all,
First of all thank you for helping me yesterday, but as we are few steps further in my process. New problems have arisen.
To give you the thought process: I have a website hosted in a different country (normal webhosting), for our company we need by law to have a database server in our own country to store specific data. Yesterday I managed to get the database server running using dynamic DNS (because of you all). But now I need to connect it using php to the mysql (mariaDB) server on ClearOs.
As of now I have managed to connect partially ...
the following error is shown on my website (webhosted) after connected a config file.
"ERROR: Could not connect. Connection refused"
So there is a connection possible, however I've read that mysql doesn't allow remote access by default. I've been searching all day but all I can find are forum posts from over a decade ago.
Can someone tell me how to activate remote access?
First of all thank you for helping me yesterday, but as we are few steps further in my process. New problems have arisen.
To give you the thought process: I have a website hosted in a different country (normal webhosting), for our company we need by law to have a database server in our own country to store specific data. Yesterday I managed to get the database server running using dynamic DNS (because of you all). But now I need to connect it using php to the mysql (mariaDB) server on ClearOs.
As of now I have managed to connect partially ...
the following error is shown on my website (webhosted) after connected a config file.
"ERROR: Could not connect. Connection refused"
So there is a connection possible, however I've read that mysql doesn't allow remote access by default. I've been searching all day but all I can find are forum posts from over a decade ago.
Can someone tell me how to activate remote access?
In MySQL Server
Share this post:
Responses (5)
-
Accepted Answer
Yhat you changes is the ports PHP will use to access mysql and not the port that mysql is listening on. What is the output of "netstat -npl | grep mysql". It I access it from my LAN or the server itself by telnet I get:
I have not tried from the internet and don't intend to open the port.[root@microserver ~]# telnet 172.17.2.5 3306
Trying 172.17.2.5...
Connected to 172.17.2.5.
Escape character is '^]'.
VHost 'wpad.local-7x.howitts.local' is not allowed to connect to this MariaDB serverConnection closed by foreign host.
On you server you can also run tcpdump. You need to know your external interface name then:
You should see some traffic when you try to connect.tcpdump -nni your_external_interface port 3306
-
Accepted Answer
Nick Howitt wrote:
Your knowledge is probably beyond mine. Can you telnet into 13306? If you can't, do you see the packets arriving in ClearOS for 13306? You can use tcpdump to check. To be honest I wouldn't expect any different behaviour if MariaDB is listening on 3306 or 13306.
telnet 192.168.0.134 port 3306
CONNECTION REFUSED
telnet 192.168.0.134 port 13306
CONNECTION REFUSED
telnet [external] port 3306
CONNECTION TIMED OUT
telnet [external] port 13306
CONNECTION TIMED OUT
tcpdump port 3306
tcpdump port 13306
both showed no activity when accessing the page.
However.
in my config.php file
define('DB_SERVER', '[hostname]:13306');
ERROR: Could not connect. Connection refused
define('DB_SERVER', '[hostname]:3306');
ERROR: Could not connect. Connection timed out -
Accepted Answer
-
Accepted Answer
Nick Howitt wrote:
Mysql (Mariadb) seems to be listening on all interfaces on tcp:3306. I presume you've port forwarded to it? If you have can you restrict the port forward to a single source IP - your web server - or you'll have hosts of attempts to connect.
What have you found to say mysql is rejecting external queries?
Hey Nick,
Should the fact that I do receive the message "ERROR: Could not connect. Connection refused" mean that it started to make a connection? I have set the TCP port for the server to 13306 (tried it with 3306 at first, but with that it just keeps loading and eventually it gives a 404). With the 13306 i get the message connecton refused.
So when I load the website page (with the config.php as required once) i get the following text back ""ERROR: Could not connect. Connection refused"". -
Accepted Answer
Mysql (Mariadb) seems to be listening on all interfaces on tcp:3306. I presume you've port forwarded to it? If you have can you restrict the port forward to a single source IP - your web server - or you'll have hosts of attempts to connect.
What have you found to say mysql is rejecting external queries?
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »