Tom Lane wrote:
> Honza Pazdziora <adelton@informatics.muni.cz> writes:
> > On Thu, Apr 08, 2004 at 10:31:44AM -0400, Tom Lane wrote:
> >> It seems that MySQL *will* read /etc/my.cnf if it
> >> exists, whether it's appropriate or not, and so it's impossible to have
> >> a truly independent test installation, even though you can configure it
> >> to build/install into nonstandard directories. Let's not emulate that
> >> bit of brain damage.
>
> > A counterexample of Apache shows that you can easily use -f or another
> > command line option to point the server to alternate master config
> > file (which I believe is the same with MySQL).
>
> According to
> http://www.mysql.com/documentation/mysql/bychapter/manual_Using_MySQL_Programs.html#Option_files
> /etc/my.cnf will be read if it exists, no matter what you say on the
> command line. So AFAICS the only way to make a private installation is
> to make sure that you have overridden each and every setting in
> /etc/my.cnf in a private config file that you do control. This is
> tedious and breakage-prone, of course.
Yes. But we don't have to do that.
If we're truly concerned about the possibility of multiple installations
attempting to use the same config, then the answer is simple: require
that the location of the config file be specified on the command line
and don't compile a default location into the binary. Similarly, don't
take the value from an environment variable.
Packaged installations won't have trouble with this: they supply a startup
script which would pass the appropriate argument to the postmaster.
If we want to be a bit paranoid (justifiable if you've got really
important data on the line), we could also require that a version
string exist in the config file. If the version string doesn't match
the version of the postmaster being started, the postmaster exits with
an error (and a hint of what to set the version string to and what the
name of the version string parameter is). That way, even if you screw
up on the command line, you won't hose a database by starting the wrong
version of the postmaster against it. Not sure if this would break
anything, though.
--
Kevin Brown kevin@sysexperts.com