Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Apr 2005 15:25:44 +0200
From:      Alex Dupre <ale@FreeBSD.org>
To:        vd@datamax.bg
Cc:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/79597: databases/mysql323-server does not find my.cnf if not placed in /var/db/mysql/
Message-ID:  <425534D8.9070707@FreeBSD.org>
In-Reply-To: <20050407105532.GA24882@sinanica.bg.datamax>
References:  <200504062254.j36MsUTX077449@freefall.freebsd.org> <4254FC55.9050805@FreeBSD.org> <20050407105532.GA24882@sinanica.bg.datamax>

next in thread | previous in thread | raw e-mail | index | archive | help
Vasil Dimov wrote:
> --defaults-extra-file=${mysql_dbdir}/my.cnf is just perfect.
> 
> What do you meen by ${PREFIX}? It is not set while mysql-server.sh
> is executing. Do you meen port's install perfix and therefore
> /usr/local/etc/my.cnf or something like /var/db/mysql/etc/my.cnf or
> just /etc/my.cnf?

The first you said: check /usr/local/etc/my.cnf and then 
/var/db/mysql/my.cnf (where /usr/local is install prefix and 
/var/db/mysql is mysql_dbdir). This would be ideal, but ...

> It seems that --defaults-file= and --defaults-extra-file= cannot
> be passed as arguments to the mysql server at the same time.

you are right, so we should use the my_print_defaults like this:

--defaults-file=/usr/local/etc/my.cnf `my_print_defaults 
--config-file=${mysql_dbdir}/my.cnf mysqld server mysqld_safe safe_mysqld`

> So we should probably use only --defaults-extra-file?

This is enough to fix your problem, but I'm thinking to a global 
solution. The above command-line options are not optimal and break POLA, 
since /etc/my.cnf is not parsed anymore. Probably the best solution is 
adding --default-extra-file=${mysql_dbdir}/my.cnf and patching the mysql 
source file mysys/defaults.c in this way:

--- mysys/default.c.orig        Thu Apr  7 15:18:21 2005
+++ mysys/default.c     Thu Apr  7 15:20:20 2005
@@ -46,18 +46,9 @@
  /* Which directories are searched for options (and in which order) */

  const char *default_directories[]= {
-#ifdef __WIN__
-"C:/",
-#else
  "/etc/",
-#endif
-#ifdef DATADIR
-DATADIR,
-#endif
+"/usr/local/etc/",
  "",                                    /* Place for defaults_extra_dir */
-#ifndef __WIN__
-"~/",
-#endif
  NullS,
  };


In this way we check for my.cnf in /etc/, /usr/local/etc/ and 
/var/db/mysql/ (where /usr/local and /var/db/mysql are always 
dynamically set by PREFIX and mysql_dbdir). Can you test the above patch 
and tell me if it works as expected?

--
Alex Dupre



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?425534D8.9070707>