Re: What led to the design of having multiple option file locations?

Sergei Golubchik <[email protected]> Mon, 10 Nov 2014 11:06:06 +0100
Newsgroups gmane.comp.db.mysql.devel
Message-ID <[email protected]>
Hi, Stewart!

You got it almost right!
A couple of comments:

On Nov 10, Stewart Smith wrote:
> Tianyin Xu <[email protected]> writes:
> > One special thing for MySQL configuration is that there're multiple
> > locations for the option files (there're 5 locations both on Windows
> > and Unix-like platforms),
> > http://dev.mysql.com/doc/refman/5.5/en/option-files.html
> 
> /etc/my.cnf largely for historical reasons.

This is also the location of my.cnf in Fedora and I suppose all
RedHat-based distributions. Not only historical.

> /etc/mysql/my.cnf as the main one as then you can do things such as
> "include /etc/mysql/*cnf" and have individual components configured in
> their own files (great for package managers!).

This is the location of my.cnf in Debian, Ubuntu and some other
distributions (Gentoo, for example).

So, mysqld reads both /etc/my.cnf and /etc/mysql/my.cnf because
different distributions put my.cnf in different locations.

And, of course, you cannot do "!include /etc/mysql/*cnf".

If you do it from /etc/mysql/my.cnf you'll end up including the same
file recursively over and over again (unless mysqld has a protection for
this case, which I doubt). If you do it from some other my.cnf - you'll
simply !include /etc/mysql/my.cnf twice.

On Redhat/etc one often uses "!includedir /etc/my.cnf.d/", on
Debian/Ubuntu - "!includedir /etc/mysql/conf.d/"

Besides, "!include" does not support wildcards.

> The SYSCONFDIR/my.cnf and $MYSQL_HOME/my.cnf really just exist to make
> it easier to have 101 mysql servers running on a single machine sharing
> some common configuration and some custom configuration.
> 
> defaults-extra-file so you can on-demand point at some other config file
> (useful when running benchmarks or experiments or something)
> 
> and ~/.my.cnf can do things like "i'm a user and i want to set options
> for my mysql client"

Regards,
Sergei

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals