Problem setting environment variable

I'm trying to set two environment variables to change the umask that mariadb-10.2 uses. I'm running the normal package from the package repository and start it using the normal service command.
Where and how should i set these variables?
 
I tried to create the file /etc/rc.conf.d/mysql-server with the content below, but it still does not work. The variables are called umask, but their value should be usermode, so the value is correct.
UMASK=0660
export UMASK
UMASK_DIR=0770
export UMASK_DIR
 
Actually all the user program daemons should reside in:
/usr/local/etc/rc.d/mysql-server

My guess the file already exists and you wrote a second file in the wrong spot.
 
Well, double-check the name of the service ;)

See here, it's just mysql, so you have to name your script /etc/rc.conf.d/mysql.

Phishfry : yes, but /etc/rc.subr will source /etc/rc.conf.d/<service name> for those anyways. It also tries /usr/local/etc/rc.conf.d/<service name> and it's a matter of taste whether you prefer to put your files there. BTW, as you write rc.d, this would be the location for the actual init script (which you shouldn't touch) ....
 
I have done some testing and what Zirias said is correct. Setting the variables i wrote above in the files /etc/rc.conf.d/mysql or /usr/local/etc/rc.conf.d/mysql works, however mariadb-10.2 will only set the folder "performance_schema" to the new usermode when initializing mariadb, while the database folders "test" and "mysql" will get the default usermode 700. Creating a new database will create a folder with the new usermode set with UMASK_DIR.
So i guess that the initialization script most likely ignores the UMASK and UMASK_DIR variables while mysqld_safe support them.
Manually changing permission on the database folders "test" and "mysql" works.
 
Back
Top