Back to feed
Renewal·마흔의 생활코딩

(Mac) MySQL Full Removal, Installation, and Setup Guide

NS
normalstory
cover image

While trying to build a service around a local LLM agent, I ended up installing MySQL again for the first time in a while. The policy changes since 8.x mattered, the version left on my machine was far too old, and even after looking back through an earlier post I had written (Old-school MySQL), I eventually decided to stop hesitating and reorganize the whole process quickly from scratch.

 

Old-school MySQL Introduction - Prologue

My LattePanda home server has been acting up lately. Rather than wasting time only patching it, I decided this was the moment to finally get into MySQL properly. The reference book was SQL for Beginners...

normalstory.tistory.com

 

 

 

The order of this guide is simple. First check whether MySQL is already installed. Then remove the ambiguous leftover installation as completely and thoroughly as possible, and reinstall it. For reference, if you want to use MySQL Workbench for easy CSV import, then as of 2024 you should install MySQL 8.0.xx.

 


 

Environment check

  • Check whether it is installed which mysql
  • Check the version mysql --version
  • Check whether it is active
    • brew list | grep mysql
    • brew services list | grep mysql
    • sudo mysql.server status

 

Completely remove MySQL (macOS)

  • Kill the MySQL process
    • Case 1: if installed through Homebrew brew services stop mysql
    • Case 2: if registered through launchctl sudo launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • Delete related files
    • Check the installation path which mysql
    • Remove via Homebrew brew uninstall --force mysql
    • Or
      • brew uninstall mysql --ignore-dependencies
      • brew remove mysql
      • brew cleanup
    • Then enter and remove the following lines one by one.
sudo rm -rf /usr/local/mysql
sudo rm -rf /usr/local/bin/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/Cellar/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /tmp/mysql.sock.lock
sudo rm -rf /tmp/mysqlx.sock.lock
sudo rm -rf /tmp/mysql.sock
sudo rm -rf /tmp/mysqlx.sock
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*

 

 

Install MySQL

  • Install the package brew install mysql@8.0  (*for MySQL Workbench compatibility)
  • Start the server mysql.server start
  • Set the root password mysql_secure_installation
  • Stop the running server  mysql.server stop 

 

 

Environment setup

  • Check your machine's default shell
    • echo $SHELL
      • => (result)   /bin/zsh
    • On macOS, the default shell changed from Bash to Zsh starting with Catalina. So if you are using a recent macOS version, Zsh is likely already your default.
  • Add the path - nano ~/.zshrc
    • Add export PATH="/usr/local/mysql-8.0.37-macos14-arm64/bin:$PATH" 
      • `mysql-8.0.37-macos14-arm64` can vary from machine to machine. Usually it is cleaner to write just `mysql`.
    • => (to exit)   :wq
  • Know the difference between shell startup files  
    Login shell When logging into the system
    (terminal login, SSH, etc.)
    ~/.zprofile (Zsh),
    ~/.bash_profile (Bash)
    Initial setup
    (environment variables, system-wide settings)
    Interactive shell Opening a new terminal tab or window,
    or starting a shell inside an already logged-in session
    ~/.zshrc (Zsh),
    ~/.bashrc (Bash)
    Daily command input, aliases, functions, and so on

 

 

Using MySQL

 

 

Options

  • Start automatically on reboot brew services start mysql
  • Stop automatic startup on reboot brew services stop mysql

 

This English version was translated by Codex.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Steadily, for the long haul, without burning out

Mar 31, 2026·9 min
Renewal

Tech-life balance

Feb 7, 2026·3 min
Renewal

Humanality, by Park Jeong-ryeol

Feb 7, 2026·11 min