The priority of my.cnf


there are something confusing me when I’m going to install Percona-Server-5.5 (Percona-Server-5.5.25a-rel27.1-277.Linux.x86_64.tar.gz) on Debian 8.8, the steps that Percona-Server installed as follows:

  1. apt-get install myql-common (mysql-common_5.5.55-0+deb8u1_all.deb), for compiling php

  2. fetch Percona-Server-5.5.25a-rel27.1-277.Linux.x86_64.tar.gz from office site, decompressing to /usr/local/customized_dir/mysql

  3. creates user (mysql); create directory: datadir and logdir, then chown mysql:mysql …

  4. config /etc/my.cnf with some paramters (basedir, datadir, logdir…)

  5. cp /usr/local/customized_dir/mysql/support-files/mysql.server /etc/init.d/mysqld

  6. mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

  7. ln -sf {INSTALL_DIR}/{MYSQL_DIR}/bin/* /usr/local/bin/

step 0 is not necessary for installing Percona-Server-5.5, but it’s will generate a dir with default my.cnf, /etc/mysql/my.cnf


if the mysql-common isn’t installed, /etc/init.d/mysqld restart will be succeed;

if the mysql-common installed before Percona-Server, /etc/init.d/mysqld restart will be failed, because it can’t fine mysqld_safe, the /etc/mysql/my.cnf override /etc/my.cnf, see figure 1.

figure 1

but as the specification of mysql doc and the mysql.server:

as defaults, the SYSCONFDIR should be /etc, so the /etc/my.cnf should override /etc/mysql/my.cnf, but the result is opposite.

Please give me a hand, thanks in advance.