1

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?

uSlackr
  • 6,412
  • 21
  • 37
Adrien Hingert
  • 309
  • 2
  • 3
  • 9

1 Answers1

2

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.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
  • 1
    This. Reading the comments on the article would have given you the same answer. – goo Feb 07 '12 at 20:01
  • Thanks for your comment, but I would like to know if there is another way. – Adrien Hingert Feb 07 '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 07 '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 07 '12 at 21:59
  • @Adrien Instead of localhost use 127.0.0.1 or more specifically 127.0.0.1:3306 – HTTP500 Feb 07 '12 at 22:10