In linux I could find the mysql installation directory with the command which mysql
. But I could not find any in windows. I tried echo %path%
and i
if you want to find datadir in linux or windows you can do following command
mysql -uUSER -p -e 'SHOW VARIABLES WHERE Variable_Name = "datadir"'
if you are interested to find datadir you can use grep & awk command
mysql -uUSER -p -e 'SHOW VARIABLES WHERE Variable_Name = "datadir"' | grep 'datadir' | awk '{print $2}'
public function variables($variable="")
{
return empty($variable) ? mysql_query("SHOW VARIABLES") : mysql_query("SELECT @@$variable");
}
/*get datadir*/
$res = variables("datadir");
/*or get all variables*/
$res = variables();