For some reasons (and only for some days to come) we are going to have 2 cnf files in /etc/mysql/conf.d directory, apart from the default one /etc/mysql/my.cnf. Now I know this can be disastrous, and we are working to resolve this.

But for the sake of knowledge ....

The config of /etc/mysql/my.cnf will be over-ridden by the cnf file in /etc/mysql/conf.d/

But between the 2 cnf files in /etc/mysql/conf.d, lets say a.cnf and b.cnf, which one would take precedence and why?

MySql version is "Ver 14.14 Distrib 5.5.30, for Linux (x86_64) using readline 5.1"

1 Answer 1


If I understand it correctly, there can be only one config file. But mine ends with

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
!includedir /etc/mysql/conf.d/

and so it is directly responsible for "merging" those additional ones into itself.

The !includedir directive is covered in the manual https://dev.mysql.com/doc/refman/5.5/en/option-files.html which states:

There is no guarantee about the order in which the option files in the directory will be read.

So it probably depends on the OS and filesystem but you should not depend on it anyway, even when it seems "stable" for now.

I sugget using the !include directive instead and maybe a different folder for those config files where the order matters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.