Virtual Server - MySQL alternate TCP port

5 posts / 0 new
Last post
#1 Tue, 10/08/2013 - 06:12
bvdijk

Virtual Server - MySQL alternate TCP port

I've got a user connecting remotely (SQLyog) to his MySQL database on the default port (tcp/3306)

Now I want the user to use an alternate port (tcp/56789 for example)

So I went to Virtualmin -> Services -> PHP 5 Configuration -> Database Settings and changed Default MySQL server port to 56789

Maybe the wrong place, and not the way to do it, please let me know, but:

MySQL for this database keeps running on the default port (tcp/3306), even after a restart of Apache/MySQL.

Any ideas, suggestions?

Thanks!

Tue, 10/08/2013 - 06:44
Locutus

Yeah, that IS the wrong place. How would changing a PHP parameter make MySQL listen on a different port? ;) This is only the default settings on which port PHP code should try to connect if no port is given in the respective function calls.

The right place is Webmin -> Servers -> MySQL Database Server -> MySQL Server Configuration : MySQL Server Port.

Then you also need to tell the Webmin module about the changed port, under Webmin -> Servers -> MySQL Database Server -> Module Config -> System Configuration : MySQL port to connect to.

Tue, 10/08/2013 - 07:13 (Reply to #2)
bvdijk

Yeah, I thought so, but maybe this MySQL config was misplaced ;-) Ok... I understand this is just for letting PHP know which port to use if none is given in the connection string ;-)

Knowing that... Your solution will change the socket/port for all Virtual Servers, I thought maybe it was possible to just change the port for one Virtual Server, but now I guess it's not.... ;-)

The real problem is that I've got a user with a desktop application in need of connecting to my MySQL server.

So I managed to open up tcp/3306 and give rights to the database/user and he was able to connect. Now he also tells me that his application can be run on other machine running with dynamic IP addresses

So ofcourse I realized that opening up my MySQL server to the public internet is not a very good idea... So for starters I wanted to start to at least put in on another port instead of the default 3306...

Tue, 10/08/2013 - 07:17 (Reply to #3)
bvdijk

I refuse to open MySQL to the public internet, so I think I'm going to look into a VPN solution like OpenVPN, I guess that's the way to go... (or use my Cisco ASA with Cisco's VPN client software)

Other ideas/suggestions very welcome

Tue, 10/08/2013 - 07:34
Locutus

Indeed you can't set the MySQL port just for one virtual server. It's a global service application that doesn't know about Virtualmin's structure.

Opening 3306 to the public Internet is indeed a bad idea, for security reasons. As you said, I'd also suggest using a VPN.

Topic locked