This is what config management systems are for. Look into puppet/chef/etc
–
kormocFeb 8 '13 at 18:49

@kormoc, that can be quite overkill, especially considering that it would be so simple to fix by adding env-var support like Apache did.
–
SynetechFeb 8 '13 at 21:07

Storing the InnoDB redo logs (innodb_log_group_home_dir) in a temporary directory -- really? You do know that those are essential, critical files during routine operation as well as crash recovery, right?
–
Michael - sqlbotFeb 9 '13 at 7:12

@Michael-sqlbot, that was just a (bad) example, it would be in another directory like something under %userappdata%, %programfiles%, etc. (if used at all). Temp is just a common variable on all systems.
–
SynetechFeb 9 '13 at 15:19

So ... your solution is for the MySQL project to radically alter their config process because it's "overkill" for a SysAdmin to script his environment using specialized DSLs?
–
jcolebrandFeb 14 '13 at 21:15

Arg! I was afraid of that. It would be horribly inconvenient to have to do that for each and every single variable that needs it: --innodb_log_group_home_dir=… --innodb_log_arch_dir=… --log-bin=… --basedir=… --datadir=… --innodb_data_home_dir=… …. And that’s assuming that every variable even can be specified on the command-line. (Thankfully I have commented all but two of them for now, but if I ever had to uncomment them…)
–
SynetechFeb 8 '13 at 17:19

I don’t like compromising, so I posted a thread at the MySQL forums to confirm if it is not possible and to request that it be added if not. In the mean-time, I am using a batch-file to run the server with the settings like you suggested. That way, I can start it with a simple command (passing in any extra arguments) which greatly simplifies some aspects of the configuration, although I now have to be wary of unwanted console windows.
–
SynetechFeb 9 '13 at 5:13

Probably not the most elegant solution but perhaps the static configuration file can be replaced by dynamic content:

You could put a FIFO at the log file path. Before you start MySQL you would have to start a mini daemon which writes to that FIFO in an endless loop. Race conditions should not be a problem here.

The daemon would write two blocks of data to the FIFO, first a dummy line like
# environment aware config file following
in order to open the FIFO. As soon as this first write returns it would get the PID of the reading process (e.g. via fuser), get the variables which occur in the file from /proc/${PID}/environ, create commands for e.g. sed to replace the references and write the sed output to the FIFO.