Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why the mysqld is located in 4 places in linux system?

Tags:

linux

mysql

I have confusion while I'm execute the command "# find / -name mysqld". Because the mysqld is located in four places which are:

  1. /usr/libexec/mysqld
  2. /etc/rc.d/init.d/mysqld
  3. /var/lock/subsys/mysqld
  4. /var/run/mysqld

What is the purpose of another three mysql daemons?

like image 602
Dhileepan Avatar asked Jul 12 '12 05:07

Dhileepan


1 Answers

Here is the following explanations

  • /usr/libexec/mysqld : The actual binary executable
  • /etc/rc.d/init.d/mysqld : The service startup file (text file)
  • /var/run/mysqld : PID/run file folder (mysqld writes a run file in this folder)
  • /var/lock/subsys/mysqld : not sure

If you run which mysqld you should see the first one

You never run that directly

When you run service mysqld start, it calls /etc/rc.d/init.d/mysqld to kickoff a program called mysqld_safe (Run which mysqld_safe). mysqld_safe and mysqld work together to be the server daemon.

In turn, mysqld_safe will kickoff mysqld and then checks for an exit code. You can run less /etc/rc.d/init.d/mysqld and see this. If mysqld did not end due to system shutdown or a normal service mysql stop, mysqld_safe will attempt to restart mysqld.

like image 124
RolandoMySQLDBA Avatar answered Sep 24 '22 16:09

RolandoMySQLDBA