Yashwanth Aluru
Yashwanth Aluru

Reputation: 1193

mysql - show processlist

When I run the command show processlist; I get details of the connections made to the server. Here are the connection details of my MySQL server,

mysql> show processlist;
+------+-----------------+----------------------+-------------+---------+----------+------------------------+------------------+
| Id   | User            | Host                 | db          | Command | Time     | State                  | Info             |
+------+-----------------+----------------------+-------------+---------+----------+------------------------+------------------+
|    1 | event_scheduler | localhost            | NULL        | Daemon  | 13200075 | Waiting on empty queue | NULL             |
| 4212 | root            | localhost            | NULL        | Query   |        0 | init                   | show processlist |
| 4214 | root            | xxx.xx.xxx.xxx:50197 | testmysqldb | Sleep   |        1 |                        | NULL             |
| 4215 | root            | xxx.xx.xxx.xxx:50198 | testmysqldb | Sleep   |        3 |                        | NULL             |
+------+-----------------+----------------------+-------------+---------+----------+------------------------+------------------+

What does the "number" after the term hostname and a colon (:) mean? It generally appears when a remote connection is made, on Linux and appears even for local connection on Windows.

Thanks in Advance!!

Upvotes: 3

Views: 3340

Answers (3)

Nabeel Ahmed
Nabeel Ahmed

Reputation: 19262

It's client port number i.e. a connection gets open between two processes (on the same host or physically apart) using sockets - Socket is host_ip:port_num

So when we connect to a mysql (on same machine - localhost or remote server) a connection is opened i.e.

client_ip:xxxxx --> mysql_ip:3306 (3306 is default for Mysql, can use other port as well)

Example: xxx.xx.xxx.xxx:50197

We send query and receive response from the mysql (mysql_ip:3306) at client_ip:50197

Upvotes: 2

Lipsum
Lipsum

Reputation: 546

It's the client's port number used for the connection.

"xxx.xx.xxx.xxx:50197" means that there's an open connection from IP address "xxx.xx.xxx.xxx" and port 50197, towards your MySQL server (probably on port 3306.)

Upvotes: 4

Andreas Scheibleger
Andreas Scheibleger

Reputation: 297

This is the client's TCP Port.

You connect to the server for example on default port 3306 but the client uses a different port on its side of the connection. This port is listed there.

Upvotes: 2

Related Questions