Identify the PID from a MySQL connection ID?Where does MySQL store files when it's “copying to tmp table”mysql with innodb_file_per_table - cannot see any .ibd filesConnecting to a new MySQL instanceWhy do MySQL queries pile up in “Sending data” state?show mysql myisam locksmysql always using maximum connectionMySQL 5.5.16 allows anonymous connectionsWhy does a mysql query, that requires copying to tmp table, randomly sometimes consume 100% CPU during several seconds?cronjob executing mysql and get root access deniedMariaDB galera cluster fail when dumping or optimizing database
A non-technological, repeating, visible object in the sky, holding its position in the sky for hours
What does "rf" mean in "rfkill"?
How to stop co-workers from teasing me because I know Russian?
Is GOCE a satellite or aircraft?
How can I get precisely a certain cubic cm by changing the following factors?
Phrase for the opposite of "foolproof"
What does YCWCYODFTRFDTY mean?
Pulling the rope with one hand is as heavy as with two hands?
Simplicial set represented by an (unordered) set
When did stoichiometry begin to be taught in U.S. high schools?
You look catfish vs You look like a catfish
How to set printing options as reverse order as default on 18.04
Any examples of headwear for races with animal ears?
When and why did journal article titles become descriptive, rather than creatively allusive?
How to pass attribute when redirecting from lwc to aura component
Is it possible to Ready a spell to be cast just before the start of your next turn by having the trigger be an ally's attack?
What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?
If Earth is tilted, why is Polaris always above the same spot?
Is it possible to measure lightning discharges as Nikola Tesla?
Single Colour Mastermind Problem
What are the spoon bit of a spoon and fork bit of a fork called?
Why does Bran Stark feel that Jon Snow "needs to know" about his lineage?
Transfer over $10k
Why do computer-science majors learn calculus?
Identify the PID from a MySQL connection ID?
Where does MySQL store files when it's “copying to tmp table”mysql with innodb_file_per_table - cannot see any .ibd filesConnecting to a new MySQL instanceWhy do MySQL queries pile up in “Sending data” state?show mysql myisam locksmysql always using maximum connectionMySQL 5.5.16 allows anonymous connectionsWhy does a mysql query, that requires copying to tmp table, randomly sometimes consume 100% CPU during several seconds?cronjob executing mysql and get root access deniedMariaDB galera cluster fail when dumping or optimizing database
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
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.
mysql
add a comment |
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.
mysql
add a comment |
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.
mysql
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.
mysql
mysql
asked Nov 10 '11 at 16:04
kdtkdt
68521730
68521730
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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.
add a comment |
There is no such mapping in mysql.
add a comment |
I have answered this in my tech blog here: http://blog.fotios.org/2018/02/find-which-process-holds-particular.html
Basically, there's two steps: 1) do a "show full processlist;" in mysql; this listing includes the port number of each socket/connection, 2) grep for that number in the "netstat -np" output
Please note that this solution does not work when you make your connection literally vialocalhost
, since mysql client treatslocalhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html
– Michał Sacharewicz
Jan 14 at 13:20
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f329775%2fidentify-the-pid-from-a-mysql-connection-id%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 10 '11 at 16:25
JakePaulusJakePaulus
2,1171117
2,1171117
add a comment |
add a comment |
There is no such mapping in mysql.
add a comment |
There is no such mapping in mysql.
add a comment |
There is no such mapping in mysql.
There is no such mapping in mysql.
answered Nov 10 '11 at 16:40
FarhanFarhan
3,32343567
3,32343567
add a comment |
add a comment |
I have answered this in my tech blog here: http://blog.fotios.org/2018/02/find-which-process-holds-particular.html
Basically, there's two steps: 1) do a "show full processlist;" in mysql; this listing includes the port number of each socket/connection, 2) grep for that number in the "netstat -np" output
Please note that this solution does not work when you make your connection literally vialocalhost
, since mysql client treatslocalhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html
– Michał Sacharewicz
Jan 14 at 13:20
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
add a comment |
I have answered this in my tech blog here: http://blog.fotios.org/2018/02/find-which-process-holds-particular.html
Basically, there's two steps: 1) do a "show full processlist;" in mysql; this listing includes the port number of each socket/connection, 2) grep for that number in the "netstat -np" output
Please note that this solution does not work when you make your connection literally vialocalhost
, since mysql client treatslocalhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html
– Michał Sacharewicz
Jan 14 at 13:20
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
add a comment |
I have answered this in my tech blog here: http://blog.fotios.org/2018/02/find-which-process-holds-particular.html
Basically, there's two steps: 1) do a "show full processlist;" in mysql; this listing includes the port number of each socket/connection, 2) grep for that number in the "netstat -np" output
I have answered this in my tech blog here: http://blog.fotios.org/2018/02/find-which-process-holds-particular.html
Basically, there's two steps: 1) do a "show full processlist;" in mysql; this listing includes the port number of each socket/connection, 2) grep for that number in the "netstat -np" output
edited Mar 4 '18 at 3:03
answered Feb 27 '18 at 1:51
Alex FotiosAlex Fotios
1113
1113
Please note that this solution does not work when you make your connection literally vialocalhost
, since mysql client treatslocalhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html
– Michał Sacharewicz
Jan 14 at 13:20
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
add a comment |
Please note that this solution does not work when you make your connection literally vialocalhost
, since mysql client treatslocalhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html
– Michał Sacharewicz
Jan 14 at 13:20
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
Please note that this solution does not work when you make your connection literally via
localhost
, since mysql client treats localhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using 127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html– Michał Sacharewicz
Jan 14 at 13:20
Please note that this solution does not work when you make your connection literally via
localhost
, since mysql client treats localhost
specially and connects using unix socket file, thus omitting TCP/IP. However, when using 127.0.0.1
, mysql defaults to TCP/IP. Reference: dev.mysql.com/doc/refman/8.0/en/connecting.html– Michał Sacharewicz
Jan 14 at 13:20
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
@MichałSacharewicz The post is not about identifying connections to mysqld from mysql client which is often moot. Regardless, I would think "show full processlist" would still list any unix socket based connections which are then also not excluded from the listing in "netstat -np"
– Alex Fotios
Jan 15 at 15:03
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f329775%2fidentify-the-pid-from-a-mysql-connection-id%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown