Can’t access mysql from command line Mac OS

The issue:

On Mac OS when we installed MySQL successfully and tried to access it from command line we got into this issue.

can't access mysql from command line

The reason:

The MySQL was installed successfully but it was not included in the $PATH variable. When we tried to print that $PATH variable MySQL was not printed.

echo $PATH

The solution:

We had to add MySQL bin path to the $PATH variable like below in the .bash_profile file.

PATH=$PATH:/usr/local/mysql/bin