How to find the mysql data directory from command line in windows

后端 未结 8 1298
后悔当初
后悔当初 2020-12-07 07:50

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

相关标签:
8条回答
  • 2020-12-07 08:17

    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}'
    
    0 讨论(0)
  • 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();
    
    0 讨论(0)
提交回复
热议问题