A Few Helpful Tips for Installing MySQL on macOS with Homebrew
Setting up MySQL on macOS is usually straightforward, but there are a few moments that can make you pause—especially if it’s your first time. When I installed it with Homebrew recently, I paid attention to the small details that weren’t obvious at first. Here’s a simple walkthrough of the things that would’ve made the process clearer from the start.
1. Update Homebrew Before You Begin
A quick but important step:
brew update
Homebrew relies on up-to-date formulae, and this small refresh prevents version mismatches that look like installation issues. It only takes a moment and sets the rest of the process up for success.
2. Homebrew Installs MySQL With No Root Password (By Design)
This part can feel surprising. After installation, Homebrew prints a message noting that MySQL was installed without a root password and suggests running:
mysql_secure_installation
This is normal. The initial setup is intentionally open, and you secure it afterward by setting a root password and applying the recommended settings.
3. The Password Prompt Looks Frozen — But It’s Working
When you run mysql_secure_installation, the password prompt provides zero visual feedback:
- no cursor
- no asterisks
- no movement
It feels like the command stalled, but it’s simply hiding input for security.
A small tip if you use iTerm2: the little key icon still works. You can paste your password even though nothing appears to happen—just paste and press Enter.
It’s unintuitive the first time, and completely normal afterward.
4. Use the Correct MySQL Login Command
Another common place to get tripped up is the login command:
mysql -u root -p
A few helpful reminders:
- There’s no dash before root
- After -p, MySQL will prompt you for the password you set earlier
- The password prompt will again show no visual feedback
When the login succeeds, you’ll see:
mysql>
At that point, you can run something like:
SHOW DATABASES;
to confirm everything is working.
5. Bonus Tip: Check Which MySQL Client You’re Using
If login ever fails unexpectedly, it’s worth checking:
which mysql
On most macOS setups, it should point to the Homebrew path—for example:
/usr/local/bin/mysql
If it points elsewhere, you may have another MySQL installation on your machine. That can lead to mismatched credentials or confusing auth errors. Switching to the Homebrew client usually resolves it quickly.
Final Thoughts
Installing MySQL with Homebrew is fairly smooth, but the silent password fields and slightly unfamiliar commands can make the experience feel more complicated than it is. Hopefully these notes make the process clearer, so the setup feels more predictable and less like guesswork.
