How to Start & Stop MySQL in MAC OS using Command Line(CMD)?



Here are the three basic commands to start, stop, and restart MySQL in Mac OS.

1. MySQL 5.7 and Below

 

Start MySQL

sudo /usr/local/mysql/support-files/mysql.server start

Stop MySQL

sudo /usr/local/mysql/support-files/mysql.server stop

Restart MySQL

sudo /usr/local/mysql/support-files/mysql.server restart

2. MySQL 5.7+

 

Start MySQL

sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

Stop MySQL

sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist