Home  >  Article  >  Operation and Maintenance  >  How to check if port 3306 is occupied in Linux

How to check if port 3306 is occupied in Linux

青灯夜游
青灯夜游Original
2022-05-25 18:21:237625browse

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.

How to check if port 3306 is occupied in Linux

#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.

How to check if port 3306 is occupied in Linux

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

How to check if port 3306 is occupied in Linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is linux snapshotNext article:what is linux snapshot