Use port 995 for MYSQL on ubuntu 20.04 server
Sophia Terry
In my MYSQL configuration file, when I replace port 3060 (original) by 995, that don't work, when I service mysql restart, I have:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.But when I replace 3060 by 5671 for example, that work, no error and my remote connection with port 5671 works!
So by searching, I find that we can't put a port < 1024... but I have to put an inferior one, how can we procced?
41 Answer
Soren is correct that ports below 1024 are restricted and requires elevated privileges. It's generally not a good idea to use ports under 1024 without a great deal of thought and planning ahead of time.
That said, if you absolutely must use a lower-numbered port, you can use iptables to redirect a lower-numbered port to the one the application is listening on.
For example:
sudo iptables -A PREROUTING -t nat -p tcp --dport 995 -j REDIRECT --to-port 3306Substitute 995 with the port to expose, and 3306 with the port your MySQL installation is listening on.
6Note:
Port 995 is used with SSL-encrypted POP3 services for encrypted mail transfer. It is also used by mail servers such as NT's Exchange Server for user auth. Reusing port numbers under 1024 can lead to all sorts of unexpected problems down the road. Be very careful when circumventing intentional restrictions.