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;








1















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




























    1















    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
























      1












      1








      1


      1






      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














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 '11 at 16:04









      kdtkdt

      68521730




      68521730




















          3 Answers
          3






          active

          oldest

          votes


















          1














          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






























            1














            There is no such mapping in mysql.






            share|improve this answer






























              1














              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






              share|improve this answer

























              • 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












              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
              );



              );













              draft saved

              draft discarded


















              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









              1














              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



























                1














                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

























                  1












                  1








                  1







                  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













                  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












                  share|improve this answer



                  share|improve this answer










                  answered Nov 10 '11 at 16:25









                  JakePaulusJakePaulus

                  2,1171117




                  2,1171117























                      1














                      There is no such mapping in mysql.






                      share|improve this answer



























                        1














                        There is no such mapping in mysql.






                        share|improve this answer

























                          1












                          1








                          1







                          There is no such mapping in mysql.






                          share|improve this answer













                          There is no such mapping in mysql.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 10 '11 at 16:40









                          FarhanFarhan

                          3,32343567




                          3,32343567





















                              1














                              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






                              share|improve this answer

























                              • 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
















                              1














                              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






                              share|improve this answer

























                              • 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














                              1












                              1








                              1







                              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






                              share|improve this answer















                              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







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








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


















                              • 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

















                              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


















                              draft saved

                              draft discarded
















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                              Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                              Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070