Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use environment variables in my.ini/my.cnf

Is it possible to read env vars in MySQL option file my.ini/my.cnf, the way it is possible in httpd.conf and php.ini with the ${ENVVAR} syntax :

datadir="${MYSQL_DATA_HOME}/Data/"

If yes, what is the syntax ?

like image 418
ejoubaud Avatar asked Jul 23 '12 18:07

ejoubaud


1 Answers

I think it is not possible. I tried making the same changes in MySQL option file, but failed to start. But there is another way though.

Set MYSQL_DATA_HOME=<some dir> in the console. And in the same terminal start mysql not by service start but with this command mysqld --datadir=$MYSQL_DATA_HOME/whatever

like image 123
Rituparna Kashyap Avatar answered Sep 22 '22 13:09

Rituparna Kashyap