ports/79597: databases/mysql323-server does not find my.cnf if not placed in /var/db/mysql/

Alex Dupre ale at FreeBSD.org
Thu Apr 7 13:25:48 UTC 2005


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



More information about the freebsd-ports-bugs mailing list