Step 1:
Install MySql with the help of homebrew. If it is not installed in your system. You can install it from here.

Step 2:

Run the below command from the terminal.

brew install mysql

Step 3:
set the path of MySQL from the below command.

sudo sh -c ‘echo /usr/local/mysql/bin > /etc/paths.d/mysql’

Close the terminal and open again and try to connect with mysql.

If you don’t want to go with a brew package manager, you can follow the below URL to install the MySQL.

https://dev.mysql.com/doc/refman/5.6/en/osx-installation-pkg.html