This question already has an answer here:

So I am in a folder where mysql executable already is..

When I try mysql in terminal I get: -bash: mysql: command not found

But this will work: Korays-MacBook-Pro:bin koraytugay$ ./mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 107 etc etc...

So why is the ./ required?

Also how can I add this mysql to my PATH?

marked as duplicate by user151019, nohillside Jun 8 '14 at 19:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


The ./ is required because "." is not in your PATH. When you enter a command, the shell will search the folders listed in the PATH environment variable for that command, if you haven't given a path with the command.

If you do not list "." (the current folder) in the PATH variable, it is simply not searched.

You add it to the PATH variable as you would any other directory - it is simply a dot.

Wheere it is set depends on which shell you use, and whether you want it set for just you or everyone. You could for example set it in the .bashrc file in your home directory or in /etc/bashrc to change it for everyone on the system.

Not the answer you're looking for? Browse other questions tagged .