Bug #8649 ./configure --sysconfdir=/someplace does not find my.cnf in /someplace
Submitted: 21 Feb 2005 13:10 Modified: 14 Jun 2006 2:21
Reporter: Peter O'Gorman Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1.10 OS:darwin
Assigned to: CPU Architecture:Any

[21 Feb 2005 13:10] Peter O'Gorman
Description:
Using the --sysconfdir configure argument should set the directory that mysql will search for configuration files, it does not. At present, on posixy systems this directory is hardcoded to be /etc in mysys/default.c, I suggest adding the variable which configure substitutes into the makefiles $(sysconfdir) to the DEFS in mysys/Makefile.am and modifying default.c to use this value instead of /etc if it is defined.

If you accept that this is a bug I can make a patch to do this, I can't be bothered doing so for a "wontfix" bug :)

Thanks,
Peter

How to repeat:
configure mysql ./configure --sysconfdir=/notetc and place a my.cnf in /notetc/my.cnf. Run mysqld --print-defaults-file to see that the defaults file has not been read.

Suggested fix:
as above
[21 Feb 2005 14:43] Sergei Golubchik
The problem is that mysqld read /etc/my.cnf for ages and we have to stick to
this for compatiblity reasons. On the other hand, respecting --sysconfdir is
also important.

Unfortunately, I don't know an easy fix. :(

You are very welcome to suggest a patch that would have the following
property: after

  ./configure --prefix=/foo

mysqld will read /etc/my.cnf and not /foo/etc/my.cnf
In other words, mysqld should only respect explicit --sysconfdir
[21 Feb 2005 14:47] Peter O'Gorman
Would it be a major issue if it looked in both $(prefix)/etc and /etc, or would you require that --sysconfdir be explicitly specifed in that case too?
[21 Feb 2005 22:40] Hartmut Holzgraefe
This has already been discussed in Bug #4993 ...

Do you know that the server also looks for $datadir/my.cnf ?

When having multiple MySQL installations on a single server
it is common to use the datadir approach only whithout creating
a /etc/mysql.cnf at all. The datadir itself can be set using
the configure options --prefix or --datadir so this might already
help to solve your problem?
[22 Feb 2005 3:07] Peter O'Gorman
Yes, I know that DATADIR is an alternative location for my.cnf, I'd still like sysconfdir to work though, I think adding something like this to configure.ac and then modifying default.c and it's makefile shoudl do the trick:

case "$@" in
  *" -sysconfdir="* | *" --sysconfdir="* | *" --sysconfdi="* \
   | *" --sysconfd="* | *" --sysconf="* \
   | *" --syscon="* | *" --sysco="* | *" --sysc="* \
   | *" --sys="* | *" --sy="*)
     ;;
  *) sysconfdir=/etc ;;
esac

Thoughts?
[13 Jun 2006 23:50] Kevin Benton
The suggested solution assumes that the user installing MySQL has root level access.  How do you suggest dealing with the non-root user that needs their own MySQL installation?
[14 Jun 2006 2:21] Peter O'Gorman
As far as I know mysql does not actually install any files into ${sysconfdir}, it just looks for them there, so what is the problem?

I don't care about this anymore though. You'll notice that it got marked "Won't fix" and that it is more than a year old. I'll just live with a local patch.