title: MySQL multiple instance on CentOS controlled by same service
body: <p>I want to run 2 separate mysql instances on CentoS which could be stopped and started separately on different ports and have totally separate databases</p>
  
  <p>My /etc/my.cnf is:</p>
  
  <pre><code>[mysqld]
  user            = mysql
  pid-file        = /var/run/mysqld/mysqld.pid
  socket          = /var/lib/mysql/mysql.sock
  port            = 3306
  datadir         = /var/lib/mysql
  
  [mysqld_safe]
  log-error=/var/log/mysqld.log
  </code></pre>
  
  <p>My /etc/my2.cnf is as follows:</p>
  
  <pre><code>[mysqld2]
  datadir=/var/lib/mysql2
  socket=/var/lib/mysql/mysql2.sock
  
  user=mysql
  Disabling symbolic-links is recommended to prevent assorted security risks
  #symbolic-links=0
  
  [mysqld2]
  user            = mysql
  pid-file        = /var/run/mysqld/mysqld2.pid
  socket          = /var/lib/mysql/mysql2.sock
  port            = 3307
  datadir         = /var/lib/mysql2
  
  
  [mysqld_safe]
  log-error=/var/log/mysqld2.log
  pid-file=/var/run/mysqld/mysqld2.pid
  </code></pre>
  
  <p>When I start mysqld service, even mysqld2 gets started and they both show same databases. I can connect to mysql on both 3306 and 3307 ports.</p>
  
  <p>service mysqld status and service mysqld2 status show to be using same pid</p>
  
  <p>How do I have 2 completely different mysqls and mysqld2 services, runninf on 3306 and 3307 port separately, which could be stopped and started totally separately?</p>