How to figure out the mysql
location on a server (windows or linux)?
I would like to run
mysql -u USER -p PASS DATABASE < filename.sql
but I need the absolute path to mysql, how do I find out?
Unix/Linux: which mysql
returns the path to the mysql
executable
I don't know about windows.
I wanted to do something similar and found this SQL statement: SHOW VARIABLES LIKE 'basedir'
$result = mysql_query("SHOW VARIABLES LIKE 'basedir'");
$row = mysql_fetch_assoc($result);
echo $row['Variable_name']." = ".$row['Value'];
It will tell you the base directory of the MySQL server. Append "/bin/" and then your command.
Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With