How to reinstall MySQL on MacOS ARM M1 (and not only)

Category: SQL :: Published at: 09.12.2024

If you have any issues with MySQL and want to completely reinstall it on your machine,

This is a quick guide on how to do it:

  • Remove MySQL libraries - i cover here a couple of possible locations; some of them won't exist on your machine
brew services list # check your mysql version
brew unlink mysql@8.0 # put correct version here
brew uninstall mysql@8.0

# remove directories
sudo rm -rf /usr/local/Cellar/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /Library/StartupItems/MySQLCOM

# kill MySQL processes
sudo killall mysqld
  • Install MySQL again
brew update
brew install mysql@8.0

# export to zshrc or bashrc
echo 'export PATH="/opt/homebrew/opt/mysql@8.0/bin:$PATH"' >> ~/.zshrc

brew link mysql@8.0 --force

brew services restart mysql

# start server
mysql.server start                                                                                                                                                                                   ─╯
Starting MySQL
=> SUCCESS! 


- Click if you liked this article

Views: 329