I have been attempting to install MariaDB on a new MacBook with Catalina installed using Homebrew. However, I hit an issue with the post-install step failing which meant the installation didn’t work. I’m sharing how I managed to successfully install MariaDB here for anyone else that hits a similar problem.

To start with I have used Homebrew to install MariaDB on my Mac. I ran brew doctor to make sure there were no problems with Homebrew and resolved anything that came up with the suggested fixes.

brew doctor

Next I did the install for MariaDB.

brew update
brew install mariadb

At this point MariaDB should have successfully installed and I should have been able to run mysql. Unfortunately for me post-install failed with the following message:

Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mariadb`
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

The important bit to note here was that there were conflicting my.cnf configuration files. To resolve this, I needed to locate where these files were so that they could be removed:

find . -name my.cnf -print

This returned the path to the file causing post-install to fail. I made a backup of this for precaution and removed the original.

cd /usr/local/etc/ && mv my.cnf my.cnf.backup

With the configuration file removed I was able to retry post-install:

brew postinstall mariadb

This ran successfully. MariaDB had successfully installed and could be run via mysql. All that was left to do was set up a root password for mysql and do a bit of a clean-up by removing the backed up my.cnf file.