MySQL – How to Add to $PATH Variable & Resolve ‘Command Not Found’ on macOS

bashcommand lineenvironment-variablesmacosMySQL

I installed MySQL on my Mac, and now I would like to add it to my $PATH variable. I want to be able to type mysql anywhere.

I tried adding the following to my .profile file:

export PATH=${PATH}/usr/local/mysql/bin/

I have restarted my Terminal but it does not do the trick. It still says: -bash: mysql: command not found.

How can I add this properly to my $PATH?

I am using OS X Yosemite.

Best Answer

Here is why your current code is not working:

export PATH=${PATH}/usr/local/mysql/bin/

You forgot the colon and the trailing "/" is unnecessary.

export PATH=${PATH}:/usr/local/mysql/bin

is the correct code.