Home >Operation and Maintenance >Linux Operation and Maintenance >How to check if port 3306 is occupied in Linux
Two methods: 1. Execute the "netstat -anp |grep 3306" command. If "LISTEN" appears behind port 3306, it means that the port is occupied. 2. Execute the "netstat -nultp" command. If there is "LISTEN" after port 3306, it means that the port is occupied.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
Linux method to check whether port 3306 is occupied
Method 1: Terminal execution command: netstat -anp | grep 3306
When LISTEN appears behind port 3306, it means that the port is occupied.
Mainly check if the monitoring status is LISTEN, which means it is occupied. The last column shows that it is occupied by the service mysqld. Check the specific port number. As long as there is this line as shown in the figure, it means it is occupied.
Method 2: Terminal execution command: netstat -nultp
This command is to view all currently used ports
You can see from the picture that my 3306 port is occupied
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check if port 3306 is occupied in Linux. For more information, please follow other related articles on the PHP Chinese website!