Solved Where should my.cnf file reside?

Hi,

I just did a new databases/mariadb101-server installation and by default, the config file resides in /var/db/mysql/my.cnf.
On my older server, my config file is located /usr/local/etc/my.cnf with the following line in /etc/rc.conf
Code:
### MariaDB Configuration
 mysql_optfile="/usr/local/etc/my.cnf"
 mysql_enable="YES"
Could someone please shade some ligh on where the mariadb config file should live?

Thank you
 
You can put it wherever you want it to live, that's the reason for the mysql_optfile parameter.

But you can have a look at the /usr/local/etc/rc.d/mysql-server script, that will tell you where it expects it as default. Traditionally this has been ${mysql_dbdir}/my.cnf (with ${mysql_dbdir} pointing to /var/db/mysql/). But it's been moving around lately with all the different MySQL and MariaDB versions. Or at least that's what I noticed when migrating from one version to another, it doesn't appear to be consistent between the different versions/forks. So to be "future-proof" make sure to set mysql_optfile correctly.
 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224294 FYI.

TLDR; MariaDB searches /usr/local/etc/my.cnf and /usr/local/etc/mysql/my.cnf too without even specifying this in mysql_optfile. As a matter of fact, mariadb respect hier(7)(). In other words, I have my conf file located in /usr/local/etc/my.cnf without specifying this in rc.conf under mysql_optfile. Ideally, you want to respect FreeBSD's hierarchy of directories. The conf file should go in /usr/local/etc/my.cnf or /usr/local/etc/mysql/my.cnf.
 
Back
Top