I am running a typical LAMP stack with Fedora: how do I find out which PHP script launched the queries which are shown when I run SHOW PROCESSLIST in MySQL?

I've read this article, but unfortunately in the "Host" column I see "localhost" instead of "IP:port". Is there an alternative method to what the author describes?


This suggests you are running your database server and your web server on the same box and they are connecting using the socket rather than via the network.

To achieve what is shown in that article, you will need to change your web-app's connection string so that it uses the network.

  • 1
    This. Reading the comments on the article would have given you the same answer. – goo Feb 7 '12 at 20:01
  • Thanks for your comment, but I would like to know if there is another way. – Adrien Hingert Feb 7 '12 at 20:24
  • 1
    Not with the method in the linked article as it relies on getting a process ID and going from there. If you're going to connect with a socket you can't do that. You'll need to run your scripts with a different user you can identify in the process list so you know which script is connecting with which user. Depending how many scripts you have connecting, this could be a real chore. Connecting over the network is a quick easy way using the method in the article. – goo Feb 7 '12 at 21:19
  • Ok, thanks Goeff. I cannot understand form the article how to switch to connections over the network. Can somebody help? – Adrien Hingert Feb 7 '12 at 21:59
  • @Adrien Instead of localhost use or more specifically – HTTP500 Feb 7 '12 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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