Bug 224294 - databases/mariadb102-server location of my.cnf - conflicting info in startup scripts
Summary: databases/mariadb102-server location of my.cnf - conflicting info in startup ...
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Bernard Spil
Depends on:
Reported: 2017-12-12 20:30 UTC by swa
Modified: 2020-07-11 20:30 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brnrd)


Note You need to log in before you can comment on or make changes to this bug.
Description swa 2017-12-12 20:30:58 UTC
The package as distributed

	mariadb102-server: 10.2.10

says upon installation via 

# pkg install mariadb10.2-server

MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc and /usr/local/etc/mysql.

YET ...

the installed /usr/local/etc/rc.d/mysql-server


# mysql_(instance_)?optfile (str): Server-specific option file.
#                       Default to "${mysql_dbdir}/my.cnf".

which defaults to /var/db/mysql/my.cnf and not /usr/local/etc/my.cnf nor /usr/local/etc/mysql/my.cnf

And which also adds --defaults-extra-file=/var/db/mysql/my.cnf to it's call to mysqld_safe when starting it all.

suggested solution:

Easiest solution is to adapt the messages when installing the package as that'll cause the least trouble for those using it already.

The messages in mysql_prestart() in should also be adapted as it too encourages /usr/local/etc and /usr/local/etc/mysql to be used instead of /etc/ and /etc/mysql (suggest it to show the location it will actually use as it has that info.
Comment 1 Dries Michiels 2018-01-18 14:24:11 UTC
Honestly, the MySQL-server startup script has this fixed already. Easiest and best would be to use the relevant bits from there.
Comment 2 Dries Michiels 2018-07-16 18:09:33 UTC
Ah, the hier(7) location of the config files is hardcoded in the patches of mariadb. The start-up script just provides fallback on older configurations where the my.cnf is still located in /var/db/mysql.

You can check the default config file it looks for by: 

mysql --verbose --help | grep -A 1 "Default options"

which yields:

/usr/local/etc/my.cnf /usr/local/etc/mysql/my.cnf ~/.my.cnf

This can be closed I think.
Comment 3 Rene Ladan freebsd_committer 2020-07-01 10:59:30 UTC
Does this also happen with 10.3 or later?
Comment 4 Bernard Spil freebsd_committer 2020-07-11 20:30:07 UTC
Port was removed on 2020-07-01