How to Open Port 3306 on Linux
To open port 3306 on Linux, you can follow these steps:
- Open the terminal and log in as the root user.
- To check the status of the system firewall, you can use the following command:
- Show the status of the ufw firewall.
- If the firewall is already enabled, please confirm if port 3306 has been allowed to pass through. If not, use the following command to add the allow rule:
- Grant permission for port 3306 by using the command ‘sudo ufw allow 3306’.
- If you are using another firewall tool (such as firewalld), please configure it according to the documentation of that tool.
- To apply the changes, you can restart the firewall service using the following command.
- Restart the ufw service using sudo systemctl.
- Make sure that the MySQL server is installed and running. If not, install and start MySQL.
- Now, the port 3306 is open and can be accessed locally or remotely.