maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #01802
Upgrade from 10.0.12 -> 10.0.13 changes default config file location behavior; build-time "-DDEFAULT_SYSCONFDIR=" is now ignored ?
I build MariaDB from src.
I've been running v10.0.12 (r4252). I've upgraded to v10.0.13 (r4346).
My build config always includes
cmake .. --debug-output \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DINSTALL_LAYOUT=STANDALONE \
-DINSTALL_SYSCONFDIR=/usr/local/etc/mariadb.DEFAULT \
-DINSTALL_SYSCONF2DIR=/usr/local/etc/mariadb.DEFAULT/conf.d \
-DDEFAULT_SYSCONFDIR=/usr/local/etc/mariadb \
...
I have always kept my config only in
/usr/local/etc/mariadb/my.cnf
with no ~/.my.cnf in existence.
Launching MariaDB (via systemd) with
/usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/etc/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/var/db/mariadb --plugin-dir=/usr/local/mariadb/lib/plugin --log-error=/var/log/mariadb/mariadb-err.log --pid-file=/var/cache/mariadb/mariadb.pid --socket=/var/cache/mariadb/mariadb.sock --port=3306
and noting
cat ./scripts/CMakeLists.txt
...
IF(INSTALL_SYSCONFDIR)
SET(sysconfdir ${DEFAULT_SYSCONFDIR})
ELSE()
SET(sysconfdir "/etc")
ENDIF()
...
&
cat ./mysys/my_default.c
...
/* Which directories are searched for options (and in which order) */
...
/*
This structure defines the context that we pass to callback
function 'handle_default_option' used in search_default_file
to process each option. This context is used if search_default_file
was called from load_defaults.
*/
struct handle_option_ctx
...
/**
Create the list of default directories.
@param alloc MEM_ROOT where the list of directories is stored
@details
The directories searched, in order, are:
- Windows: GetSystemWindowsDirectory()
- Windows: GetWindowsDirectory()
- Windows: C:/
- Windows: Directory above where the executable is located
- Unix: /etc/ or the value of DEFAULT_SYSCONFDIR, if defined
- Unix: /etc/mysql/ unless DEFAULT_SYSCONFDIR is defined
- ALL: getenv("MYSQL_HOME")
- ALL: --defaults-extra-file=<path> (run-time option)
- Unix: ~/
On all systems, if a directory is already in the list, it will be moved
to the end of the list. This avoids reading defaults files multiple times,
while ensuring the correct precedence.
@retval NULL Failure (out of memory, probably)
@retval other Pointer to NULL-terminated array of default directories
*/
...
&
@ https://mariadb.com/kb/en/mariadb/documentation/getting-started/configuring-mariadb-with-mycnf/
On a Linux, Unix or Mac server, MariaDB looks for the my.cnf file in the following locations:
Location Scope
/etc/my.cnf Global
/etc/mysql/my.cnf Global
SYSCONFDIR/my.cnf Global
$MYSQL_HOME/my.cnf Server
defaults-extra-file File specified with --defaults-extra-file=path, if any
/.my.cnf User
SYSCONFDIR is the directory specified with the CMake SYSCONFDIR option when MariaDB was built, by default etc under the compiled-in installation directory.
with MariaDB v <= 10.0.12, changes to my config have always been correctly picked up, INCLUDING by all mysql client tools.
So, for example, if in my.cnf I add
...
[client]
user = root
password = 'XXXXXX'
...
then at shell, instead of
mysqlshow -u root -p
password: XXXXXX
I can just
mysqlshow
and the options as specified are picked up.
With MariaDB 10.0.13, the config file is ignored; no changes to it are picked up. The client apps still require cmd line "-u" & "-p", e.g.
mysqlshow -u root -p
But if I simply
cp -af /usr/local/etc/mariadb/my.cnf ~/.my.cnf
then, the changes are picked up -- from the ~/.my.cnf location.
and just
mysqlshow
works, as previously.
Is this change in behavior intentional? What't the correct, expected/intended behavior? If it's changed, how do I now specify and use the default config file location?
Grant
Follow ups