Torbjorn Zetterlund

Fri 05 2016

Solving “-bash: mysql: command not found” In MAMP Pro 3

by bernt & torsten

So you found your self with a problem, you can not access MySQL from your terminal command line, you get a message – Solving “-bash: mysql: command not found” In MAMP Pro 3

This message is displayed due to the fact that 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

You can correct this very easy, 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”