[MDEV-16879] MariaDB no longer reads /etc/mysql/my.cnf Created: 2018-08-02  Updated: 2018-08-08  Resolved: 2018-08-08

Status: Closed
Project: MariaDB Server
Component/s: Configuration, Platform RedHat, Server
Affects Version/s: 10.0, 10.1, 10.3.8, 10.2, 10.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Michal Schorm Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Fedora, RHEL


Issue Links:
Problem/Incident
is caused by MDEV-6485 [PATCH] Hard-coded paths in the sourc... Closed

 Description   

Hello,

MariaDB should search 3 locations for a config files:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

However it only does 2 now, ommiting /etc/mysql/my.cnf


In RHEL there is a MariaDB 5.5 in base, which reads all of the three locations.
In addition there are software collections which makes 10.2 and 10.3 available for the customers. The 10.3 version reads only 2 locations and also says such in the "mysqld --help --verbose"


I'd love to get it either fixed so it will accept all of the 3 locations as usual, or properly reasonably documented, why it was removed.


Downstream tracker (RedHat Bugzilla): #598173

Hint from IRC discussion:
It * could * be in MariaDB source for RPM builds only.
Thus not reproducible without RPM packages.

Fast command to check the mysqld help:

/usr/libexec/mysqld --help --verbose | grep --after=1 '^Default options' | tail -n 1



 Comments   
Comment by Alice Sherepa [ 2018-08-02 ]

Reproduced on Centos 7.5.1804 docker image, built with yum (sudo yum install MariaDB-server MariaDB-client)

[root@bc1b8047d3c0]# mysql --help | grep "Default options" -A 1 
Default options are read from the following files in the given order:
/etc/my.cnf ~/.my.cnf

Comment by Elena Stepanova [ 2018-08-03 ]

The change was made in 10.0, in the scope of MDEV-6485.

commit 91c47e6fdf9aff728761177aff731442efc5ab29
Author: Sergei Golubchik
Date:   Sun Aug 3 17:13:56 2014 +0200
 
    MDEV-6485 Hard-coded paths in the source cannot be opt-out
    
    when looking for my.cnf files: if DEFAULT_SYSCONFDIR (or INSTALL_SYSCONFDIR)
    is specified (for rpms it always is), use that instead of hardcoded /etc path.

Before that, /etc/ and /etc/mysql were looked into unconditionally; after the change, they are only looked into if DEFAULT_SYSCONFDIR (or INSTALL_SYSCONFDIR) are not specified, and just as the commit comment says, for RPMs it always is.

Assigning to serg for deciding on further actions.

Comment by Sergei Golubchik [ 2018-08-03 ]

mschorm, as you can see the patch from MDEV-6485 was contributed by hhorak, part of the reasoning being "The attached are two related patches we use in Fedora".

I'm a bit confused now.

Comment by Honza Horak [ 2018-08-03 ]

The original idea of the patches in MDEV-6485 was to not hard-code the paths, but rather use the CMAKE-configured paths for the my.cnf. Removing /etc/mysql/my.cnf was not the intention, I'd maybe call it even an incomplete patch, and it would probably be ok to include also "DEFAULT_SYSCONFDIR+/mysql".

Anyway, since for our distros (Fedora, RHEL, CentOS), the path /etc/mysql/my.cnf was never used, and for non-RPM distros the /etc/mysql/my.cnf still works (according to https://mariadb.com/kb/en/library/configuring-mariadb-with-mycnf/), I don't consider it a real problem for users and we should be fine to keep it.. So, unless somebody disagrees, I'd be fine with closing this issue.

Comment by Sergei Golubchik [ 2018-08-08 ]

The behavior is:

  • if the location for my.cnf was specified at compile time, my.cnf is looked up there.
    • for RPM packages this location is /etc
  • if the location was not specified, the historical hard-coded paths /etc/my.cnf and /etc/mysql/my.cnf are used (presumably something that works both on rpm and deb based distros).
Generated at Thu Feb 08 08:32:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.