How do I find out where MySQL is installed on Mac OS X 10.7.9? I have MAMP installed so I presume that it is bundled with this install?
8 Answers
To check MySQL version of MAMP , use the following command in Terminal:
/Applications/MAMP/Library/bin/mysql --version
Assume you have started MAMP .
Example output:
./mysql Ver 14.14 Distrib 5.1.44, for apple-darwin8.11.1 (i386) using EditLine wrapper
UPDATE: Moreover, if you want to find where does mysql installed in system, use the following command:
type -a mysql
type -a
is an equivalent of tclsh built-in command where
in OS X bash shell. If MySQL is found, it will show :
mysql is /usr/bin/mysql
If not found, it will show:
-bash: type: mysql: not found
By default , MySQL is not installed in Mac OS X.
Sidenote: For XAMPP, the command should be:
/Applications/XAMPP/xamppfiles/bin/mysql --version
-
@ShivanRaptor by installing MAMP, I have mysql in the location you mentioned and the command to show the version works. But, the
type
command doesn't find it. Is that normal? Feb 24, 2014 at 18:52 -
4MAMP does not install mysql in the search paths of
type
, therefore mysql cannot be found. You may wantfind / -iname "mysql"
– RaptorFeb 25, 2014 at 2:25 -
please edit the title of your question to specify that you are usingMAMP Mar 26, 2016 at 15:07
-
1+1 for
type -a mysql
. That's so handy. I installed MySQL like 4 different time (default setup, mamp, homebrew, manually..) before I got it to work Jul 2, 2018 at 14:27 -
Try : [ find / -iname "mysql" -print -quit ] to stop right after finding the first match Jul 11, 2020 at 15:15
It will be found in /usr/local/mysql
if you use the mysql binaries or dmg to install it on your system instead of using MAMP
-
1Hello, I have used the dmg but I have 2 folders under local: mysql mysql-5.5.38-osx10.6-x86_64 Why might this be? Jun 8, 2014 at 16:02
-
2@KorayTugay One could be a symlink to the other so that running mysql will run the full name version, that was the case on my system May 14, 2015 at 10:36
If you run SHOW VARIABLES
from a mysql console you can look for basedir.
When I run the following:
mysql> SHOW VARIABLES WHERE `Variable_name` = 'basedir';
on my system I get /usr/local/mysql
as the Value returned.
(I am not using MAMP - I installed MySQL with homebrew.
mysqld
on my machine is in /usr/local/mysql/bin
so the basedir is where most everything will be installed to.
Also util:
mysql> SHOW VARIABLES WHERE `Variable_name` = 'datadir';
To find where the DBs are stored.
For more: http://dev.mysql.com/doc/refman/5.0/en/show-variables.html
and http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_basedir
-
-
Yes, I have installed XAMPP and MySql is also gets installed with XAMPP, so when I run above query in phpMyAdmin's SQL query box I got '/opt/lampp'. Which is referring to Xampp's location. Nov 27, 2019 at 11:52
-
If you downloaded mySQL using a DMG (easiest way to download found here http://dev.mysql.com/downloads/mysql/) in Terminal try: cd /usr/local/
When you type ls
you should see mysql-YOUR-VERSION. You will also see mysql which is the installation directory.
If you've installed with the dmg, you can also go to the Mac "System Preferences" menu, click on "MySql" and then on the configuration tab to see the location of all MySql directories.
Reference: https://dev.mysql.com/doc/refman/8.0/en/osx-installation-prefpane.html
for me it was installed in /usr/local/opt
The command I used for installation is brew install mysql@5.6
Or use good old "find". For example in order to look for old mysql v5.7:
cd /
find . type -d -name "mysql@5.7"
For me I was able to get the location at the path "/opt/homebrew/etc"
I have installed mysql using homebrew.
If you are not able to get the exact path start the mysql server -> mysql.server start
then run mysql -v to check the version, it will bring you in to the mysql.
run SHOW VARIABLES WHERE Variable_name
= 'basedir'.
Navigate to path "/opt/homebrew/etc"