Pre-Requisite
Step 1
Using any SQL clients install the MySql in your Mac
- MySQL .dmg Archive (Download Link: https://dev.mysql.com/downloads/mysql/)
- Brew (CLI)
Command for Brew
brew install mysql
Error
brew reinstall mysql
If its still not working, execute below commands to remove all the folders and run the brew install command again.
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
Step 2
mysqld --initialize
If mysqld command not found is returned, add the below paths
vi /etc/paths
Add the below paths to it
/usr/local/mysql/bin
/usr/local/mysql/support-files
Error
!!!! Do not create "data" folder under /usr/local/mysql* !!!!
The mysql "--initialize" command will take care of it. Delete the data folder if its created by you.
"The designated data directory /usr/local/mysql-8.0.25-macos11-x86_64/data/ is unusable. You can remove all files that the server added to it."
Step 3
Start the mysql server
mysql.server start
If you still face issues try uninstalling mysql and follow from all the Steps.