Start using MySQL

Install MySQL 8.4 on macOS

Install the MySQL 8.4 LTS server and client with Homebrew, then verify the version before creating any data.

Installing MySQL gives you two things: the server, a background process that owns the data and listens for connections, and the mysql client you use to talk to it. One install, both pieces.

This course uses the versioned MySQL 8.4 LTS Homebrew formula. Pinning the version matters: 8.4 is a long-term support release, so its behavior stays stable while you learn, and the versioned formula will not surprise you with a major upgrade during a routine brew upgrade.

brew install [email protected]
brew services start [email protected]

The first command installs the software. The second registers the server with launchd and starts it, so it also comes back after a reboot.

The formula is keg-only, which means Homebrew installs it without linking its binaries into your PATH. Typing mysql right after installation can therefore fail with command not found even though the install succeeded — nothing is broken. You can run its client with the full Homebrew path:

$(brew --prefix [email protected])/bin/mysql --version

The output should start with mysql Ver 8.4. That single line verifies both the install and which release line you are on. If you want plain mysql to work, add the directory to your PATH using the line Homebrew printed at the end of the install; run brew info [email protected] to see it again.

Confirm the server side too:

brew services list

The [email protected] row should say started. If it says error, check the log file the output points at before reinstalling anything.

If you installed MySQL another way — the official installer, Docker, Linux packages — use that installation’s service and client instructions. The SQL in this course is identical everywhere.

Authentication defaults depend on the package and platform. A fresh Homebrew installation may allow a local administrative connection without a password until you run mysql_secure_installation. Do not assume another installation behaves the same way.

Lesson completed

Take this course offline

Get every free book, course edition, and software download.

Get the download library →