Mac OS
MySQL
stop MySQL
database management
system administration

How do you stop MySQL on a Mac OS install?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

How you stop MySQL on macOS depends almost entirely on how MySQL was installed. A Homebrew service is managed differently from an Oracle DMG install, and both are different from a manually started server process. The fastest path is to identify the installation style first, then use the matching stop command instead of guessing.

If MySQL Was Installed with Homebrew

Homebrew-managed services are the most common modern setup on macOS. If that is how MySQL was installed, stop it with brew services:

bash
brew services stop mysql

If you are running a versioned formula, the service name may be more specific, such as [email protected]:

bash
brew services list
brew services stop [email protected]

This is the cleanest stop path because Homebrew knows how the service was registered with launchd.

If MySQL Was Installed from the Official Package

Oracle's package installs usually include support files and may register a launch daemon. A common stop command is:

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

Some installations also expose a MySQL preference pane or startup item, depending on the version of macOS and the package generation. If your install came from the official DMG, the support-files script is often the most reliable terminal-based option.

If you are unsure whether that path exists, check it first:

bash
ls /usr/local/mysql/support-files/

If MySQL Was Started Manually

Sometimes MySQL is running because you launched mysqld yourself or via a custom script. In that case, service wrappers may not work, because there is no registered service to stop.

First find the process:

bash
ps aux | grep mysqld

Then stop it gracefully if you have a matching admin path. For example, if mysqladmin is available and credentials permit it:

bash
mysqladmin -u root -p shutdown

That is safer than killing the process abruptly because it gives the server a chance to flush and shut down cleanly.

Verify That It Really Stopped

After issuing the stop command, confirm the result rather than assuming it worked.

bash
ps aux | grep mysqld

For Homebrew services, also check the service table:

bash
brew services list

Verification matters because a failed stop command can leave background processes running, which becomes confusing the next time you try to restart the server.

Avoid Using kill -9 as the First Choice

Force-killing MySQL should be a last resort. kill -9 does not allow the server to clean up normally and can increase the risk of recovery work on next startup.

If you truly cannot stop it cleanly, try a normal terminate signal first:

bash
kill <pid>

Only escalate if graceful shutdown paths are unavailable or the process is stuck.

Common Pitfalls

  • Running a Homebrew stop command against an Oracle package install, or vice versa.
  • Forgetting to check the exact service name when a versioned Homebrew formula is installed.
  • Assuming MySQL is daemon-managed when it was actually started manually.
  • Using kill -9 too early instead of trying mysqladmin shutdown or the service command.
  • Not verifying that mysqld actually exited after the stop command.

Summary

  • The correct stop command depends on how MySQL was installed on macOS.
  • Use brew services stop ... for Homebrew installs.
  • Use /usr/local/mysql/support-files/mysql.server stop for many official package installs.
  • If MySQL was started manually, shut it down with mysqladmin or a controlled process stop.
  • Always verify that the server process actually stopped before moving on.

Course illustration
Course illustration

All Rights Reserved.