Find out where MySQL is installed on Mac OS X
To check MySQL version of MAMP , use the following command in Terminal:
Assume you have started MAMP .
./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:
Where is MYSQL installed on Mac?
The installation layout is similar to that of a tar file binary
distribution; all MySQL binaries are located in the directory
/usr/local/mysql/bin. The MySQL socket file is created as
/tmp/mysql.sock by default. See Section 2.7, “Installation Layouts”.
It's probably not added to your
$PATH, thus why the commands aren't visible in the terminal. Try typing
echo $PATH on your terminal to see if
/usr/local/mysql/bin is included in the path.
Additionally, on the terminal, you can type
which mysql. If that returns nothing your environment is not finding your MySQL binary.
Can't find MySQL on MAC
To view hidden folders in Finder:
- Open Terminal found in
Finder > Applications > Utilities
Terminal, paste the following:
defaults write com.apple.finder AppleShowAllFiles YES
- Hold the
- Then right click on the Finder icon in the dock and select
MySQL data directory location
See if you have a file located under
/etc/my.cnf. If so, it should tell you where the data directory is.
My guess is that your mysql might be installed to /usr/local/mysql-XXX.
You may find these MySQL reference manual links useful:
- Installing MySQL 8.0 on MacOS
- Installing MySQL 5.7 on MacOS
- Installing MySQL 5.6 on MacOS
- Installing MySQL 5.5 on MacOS
mysql command is not found in macOS
The documentation for MySQL says:
When installing using the package installer, the files are installed into a directory within /usr/local matching the name of the installation version and platform. For example, the installer file mysql-5.7.29-osx10.13-x86_64.dmg installs MySQL into /usr/local/mysql-5.7.29-osx10.13-x86_64/.
Once you verify that there is a bin folder in this directory, you have to make sure that the terminal looks for the MySQL command there. This can be done by executing the following command:
Location of my.cnf file on macOS
This thread on the MySQL forum says:
By default, the OS X installation does not use a my.cnf, and MySQL just uses the default values. To set up your own my.cnf, you could just create a file straight in /etc.
OS X provides example configuration files at
And if you can't find them there, MySQLWorkbench can create them for you by:
- Opening a connection
- Selecting the 'Options File' under 'INSTANCE' in the menu.
- MySQLWorkbench will search for my.cnf and if it can't find it, it'll create it for you
Where is the created MySQL database folder stored in Mac OS X?
Run this query:
SELECT @@datadir, @@innodb_data_home_dir
The exact files and or subfolders depend on the exact database name and table types.
Mac install and open mysql using terminal
(Updated for 2017)
When you installed MySQL it generated a password for the root user. You can connect using
/usr/local/mysql/bin/mysql -u root -p
and type in the generated password.
root user in MySQL used to not have a password and could only connect from localhost. So you would connect using
/usr/local/mysql/bin/mysql -u root
Mysql command not found in OS X 10.7
This is the problem with your $PATH:
$PATH is where the shell searches for command files. Folders to search in need to be separated with a colon. And so you want
/usr/local/mysql/bin/ in your path but instead it searches in
/usr/local//usr/local/mysql/bin/private/var/mysql/private/var/mysql/bin, which probably doesn't exist.
Instead you want
If you want this to be run every time you open terminal put it in the file
.bash_profile, which is run when Terminal opens.
How to Merge Rows on Specific Condition
Checking a Column If It Contains a Row Value
Sql: How to Get Both Match and Non-Match Records
How to Use Select Distinct and Concat in the Same SQL Statement
T-Sql Challenges from Hackerrank
How to Extract Part of a String in Hive
Insert Distinct Values from One Table into Another Table
How to Display Half Records from Table - MySQL
How to Divide Sum in Number from Count in Having
Reactjs Connection With Database
Copy and Insert to Same Table No Duplication and With Minor Changes to Value
Replace Default Null Values Returned from Left Outer Join
Job for Mysqld.Service Failed See "Systemctl Status Mysqld.Service"
Mysql Truncated Incorrect Double Value
SQL Server Dynamic PIVOT Query
Count Table Difference Between Two Tables by a Complex Key in Hive