Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed I have an abnormally large amount of mysqld processes which have various mysql queries; I've restarted mysqld and all of these processes come back within 10 seconds.

I know the processes are being spawned using php; but do not know how to trace this. How does one do this?

share|improve this question

Run the next query from the CLI-client or from phpmyadmin or your favourite mysql-tool:

       LEFT(`INFO`, 51200) AS `Info` 
   FROM `information_schema`.`PROCESSLIST`;

and you'll see who has locked your bases. Certainly, I'm sure that at least one index in your bases is broken and has to be rebuilt. You have to run DB analysis/reparing to fix your problem:

REPAIR TABLE database.table;
share|improve this answer

Unless you're running multiple database -instances- you should only have one mysqld process running.

share|improve this answer
up vote 0 down vote accepted

To answer my own question this is what I found; it depends heavily on your environment and involves the usage of lsof and strace.

You'll need to find the process ID of your request (using lsof or netstat or any other network tool in Linux). Once you've got this you'll want the parent process ID which you can get through ps. You will then want to strace that PPID with the following: strace -f -tt -T -s 10000 -p <PPID> -o ~/out.strace.

Another way to do this is more advanced and involves the usage /proc/. You'll also have to get the PPID of your connection using lsof. You will then do an ls -la /proc/<ppid>/fd/ and grep for socket:[*number*]. You will then do an lsof on all the *number*s and then strace all of the pid's from those *number*s.

share|improve this answer

Your Answer


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.