Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The output from 'mysqladmin processlist' looks like this:

+-------+------+-----------+-------+---------+------+-------------------+------------------------+
| Id    | User | Host      | db    | Command | Time | State             | Info                   |
+-------+------+-----------+-------+---------+------+-------------------+------------------------+
| 4411  | root | localhost | mydb1 | Sleep   | 86   |                   |                        |
| 12911 | root | localhost | mydb1 | Sleep   | 50   |                   |                        |
| 65142 | root | localhost | mydb1 | Query   | 4    | copy to tmp table | OPTIMIZE TABLE my_tble |
| 65428 | root | localhost |       | Query   | 0    |                   | show processlist   |
+-------+------+-----------+-------+---------+------+-------------------+------------------------+

From an 'Id' value in that table, how can I trace back to the PID of the process which created the connection, to figure out who is doing what? All the connections are via a local socket.

share|improve this question
add comment

2 Answers

I would recommend using multiple user accounts. An alternative is to keep a connection history by writing out connection id, process id, script name, and a date/time stamp to a log file or table. I don't know of any other way to track this information.

share|improve this answer
add comment

There is no such mapping in mysql.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.