LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why are multiple instances of mysqld running? (https://www.linuxquestions.org/questions/linux-newbie-8/why-are-multiple-instances-of-mysqld-running-291470/)

philpq 02-17-2005 01:03 PM

Why are multiple instances of mysqld running?
 
When I look at the Process Table in KDE System Guard it shows 10 instances of mysqld running - each with a different PID.
How do I go about finding what and how these are being started?

Regards

jtshaw 02-17-2005 01:51 PM

You a ps -aeLf | grep mysqld

You should get something like this:

Code:

UID        PID  PPID  LWP  C NLWP STIME TTY          TIME CMD
root      958    1  958  0    1 14:38 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql    5196  958  5196  0    1 14:38 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql    30966  5196 30966  0    1 14:38 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql    10776 30966 10776  0    1 14:38 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
mysql    1036 30966  1036  0    1 14:38 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
root      4024  8245  4024  0    1 14:46 pts/2    00:00:00 grep mysqld

Now, following this you can see /usr/bin/mysqld_safe was executed (PID 958). This in turn called mysqld (PID 5196). That mysqld called another mysqld (PID 30966) which in turn called two more mysqld's (PID 10776 and 1036). You can tell this because PPID shows you the parent process.

Now the mysqld_safe in my case was has a parent of PID 1, which is init, which usually means it was executed by the init scripts.

The reason mysql works starts multiple processes/threads is because it can run more efficiently that way.

philpq 02-17-2005 03:01 PM

What an excellent, clear and well illustrated answer. I now understand what is going on.
Many thanks.


All times are GMT -5. The time now is 03:25 PM.