Solving "sh: mysql: command not found" In MAMP Pro 2 and MAMP Pro 3

If you are reading this there is a possibility you have run into this error message in your terminal window: sh: mysql: command not found

This error is being displayed because MAMP Pro stores MySQL in a location on your Mac that isn’t added to your main $PATH. MySQL is stored in the MAMP Pro bin folder here: /Applications/MAMP/Library/bin/mysql

Fortunately the fix is rather simple following the below steps:

  • In your home directory create or edit the file “.bash_profile” you can access your home directory by typing: cd ~/
  • Add this to the top of the file: export PATH=$PATH:/Applications/MAMP/Library/bin
  • Save the file and then restart your Terminal
  • In your newly restarted Terminal window type: mysql –version

This will now map MySQL to your path and allow you to access it by just typing “mysql”