How to install MySQL on MAC

Download and install MySQL dmg.

Keep note of the root user password and save it in a secure place.

The installation will be done at mysql-8.0.27-macos11-x86_64

A sym link will automatically be created at /usr/local/mysql

Creatye a new symlink at /usr/local/bin path so that we can access mysql by typing mysql command at the terminal:

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

After typing mysql command in the terminal now you can access the mysql service:

mysql -u root -p

You will have to type password in the prompt to proceed further, this is the same password which you set for root user while instally mysql.

Run the SELECT VERSION(); command to confirm that mysql commands are working.

You will get the output like his

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.27    |
+-----------+
1 row in set (0.00 sec)