Laravel Herd is an amazing application designed to make it as easy as possible to get started with PHP development.
I have been using Homebrew to run MySQL, Redis, Meilisearch, and more, but since we recently got Herd Pro, I figured it made sense to consolidate.
Here are a few other articles on how to migrate databases to Herd Pro:
- Jason Beggs: migrate from DBngin by copying the data files to Herd Pro
- Ben Holmen: migrate from Homebrew by using
mysqldump
My method is a combination of the two: copy the data files from the Homebrew MySQL to Herd Pro to save the time that it would take to dump and import.
Note: this only works if your homebrew MySQL and Herd Pro MySQL are on the same minor version (8.0.1 to 8.0.3 would work; 8.0.x to 8.4.x would not).
- Stop the homebrew MySQL service, if you haven’t already:
brew services stop mysql
(or maybe[email protected]
if you’ve updated in the past few months) - Stop the Herd MySQL service, if you haven’t already, using the Herd services UI
- Find the Herd data directory: right-click on the MySQL service and choose “Open data directory”
- Copy or move the files to retain a backup
- Find the homebrew data directory: in a terminal, run
open $(brew --prefix)/var/mysql
to open the directory in Finder - Copy the files to the Herd data directory
- Restart Herd
- After you’ve confirmed everything is fine, maybe delete the homebrew mysql data directory and
brew uninstall [email protected]