linux下进程号和端口号查看
查看mysql进程号和进程名
# ps -ef|grep mysql mysql 16565 15065 0 02:22 pts/0 00:00:18 /ultrapower/mysql/bin/mysqld --defaults-file=/ultrapower/mysql/my.cnf --datadir=/ultrapower/mysql/data --basedir=/ultrapower/mysql --user=mysql root 17058 15065 0 03:29 pts/0 00:00:00 grep --color=auto mysql
根据进程号查端口号
# lsof -i|grep 16565 mysqld 16565 mysql 31u IPv6 49174 0t0 TCP *:33060 (LISTEN) mysqld 16565 mysql 35u IPv6 50244 0t0 TCP *:22306 (LISTEN)
# netstat -anp|grep 16565 tcp6 0 0 :::22306 :::* LISTEN 16565/mysqld tcp6 0 0 :::33060 :::* LISTEN 16565/mysqld unix 2 [ ACC ] STREAM LISTENING 50242 16565/mysqld /tmp/mysqlx.sock unix 2 [ ACC ] STREAM LISTENING 50245 16565/mysqld /ultrapower/mysql/data/mysql.sock
根据端口查进程
# lsof -i:22306 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 16565 mysql 35u IPv6 50244 0t0 TCP *:22306 (LISTEN)
# netstat -anp|grep 22306 tcp6 0 0 :::22306 :::* LISTEN 16565/mysqld