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

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?

share|improve this question

1 Answer 1

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.

share|improve this answer
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 127.0.0.1 or more specifically 127.0.0.1:3306 –  HTTP500 Feb 7 '12 at 22:10

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.