Re: What led to the design of having multiple option file locations?
Tianyin Xu <[email protected]> Tue, 11 Nov 2014 10:37:19 -0800
| Newsgroups | gmane.comp.db.mysql.devel |
|---|---|
| Message-ID | <CABBDWwdF0SnhiJ_7vBvUoqopJAC39ky84FYpOCa6BE3Dj=FaEw@mail.gmail.com> |
Thanks a lot for the explanation, Stewart and Sergei! Basically the main purpose is to support different conventions such as Redhat- and Debian-based distributions. Wait... Isn't this a bad way to do things? I think the right way is to decide at installation time: figure out the type of system and decide the location of the configuration file. This makes even less sense when using pre-compiled mysql packages for specific distribution (e.g., the ones dedicated for Fedora and Ubuntu via yum or apt-get). The side-effect of multiple locations is the "inheritance-rewrite" relations from the parent locations to the child locations. If /etc/my.cnf is for Fedora and /etc/mysql/mysql.cnf is for Debian. Why the Debian location has to listen to the Fedora one? :-P Again, the downside for multiple locations is that it confuses users (at least myself), especially when someone modifies a parent location. Best, Tianyin On Mon, Nov 10, 2014 at 2:06 AM, Sergei Golubchik <[email protected]> wrote: > 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 -- Tianyin XU, http://cseweb.ucsd.edu/~tixu/ -- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/internals