How to Intall MySQL on MacOS using HomeBrew

Posted by Chaitanya Shahare on Tue, Jan 3, 2023

Prerequisites

HomeBrew

Installing MySQL

To install MySQL, run the following command in your MacOS terminal:

brew install mysql

Running MySQL

To start MySQL server, run the following command:

brew services start mysql

Verifying

To check whether MySQL server is running, run the following command:

brew services list

Usage

mysql -u root

Password

For setting Password and other configuration, run the following command after MySQL server has started

mysql_secure_installation

Usage after Password

mysql -u root -p

Then enter the password.

Stopping

To stop MySQL server,

brew services stop mysql