Home » Mysql » MySQL Command not Found [MAMP]

MySQL Command not Found [MAMP]

Posted by: admin November 30, 2017 Leave a comment


I’m working to set up my MySQL server using MAMP.

Current Status:
Downloaded MySQL, MAMP
Running MAMP: MySQL Server is green, plus it appears as a process in activity monitor

I tried:

$ mysql
-bash: mysql: command not found

I saw some tutorials that recommended adding a path to my .profile file. So I created a .profile file and added

export PATH

I then saved it as .profile in the home directory.

Again I tried

$ mysql
-bash mysql: command not found

Does anyone have any idea what’s wrong?


OS: Mountain Lion


A simple way is to just run

sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql

What this does is add a symbolic link for the mysql binary from MAMP into your executable path – in this case, within /usr/local/bin/

Warning: If you’ve installed MySQL manually as well, this may interfere with that installation, so don’t do this if you have!


This is MAMP for mac.

Firstly check the path where mysql command is located in your machine. For example mine is:


Test entering that in terminal will get you some kind of mysql response depending if your login is successful. For e.g:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Now we’ll want to add this in $PATH so that you only need to run “mysql” without the folders path.

To do that, first check $PATH, enter in terminal:

echo $PATH

Next enter:

nano .bash_profile

Add this one line (use your own mysql bin path):

export PATH="/Applications/MAMP/Library/bin:$PATH"

Press Ctrl + o to save, press enter/return key to confirm the filename is .bash_profile.

Then Press Ctrl + x to exit the editor.

Close the terminal. Re-open terminal. Enter:

echo $PATH

Your $PATH now includes mysql bin path. You should now be able to call mysql command from any directory.

Credits to http://coolestguidesontheplanet.com/add-shell-path-osx/


MAMP docs (http://documentation.mamp.info/en/mamp/how-tos/using-mysql-command-line) says it should be here:

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot


First you must verify the path to the mysql binary. After that you can extend (in ~/.profile) your PATH i.e.

export PATH=$PATH:/path/to/mysql/bin/

After editing .profile you have to logout/login to active changes or source your .profile

source ~/.profile