Install MariaDB on Mac
There are so many articles online which lead you to install MariaDB on your Mac. Here I will go through the steps that I used and show the solution that will address some issues while installing it.
Requirements
In order to install MariaDB on Mac, you need to make sure that Xcode from App Store and HomeBrew are ready as we have to use brew to install MariaDB. Before the installation, I recommend you to run doctor command first to check if everything is good to go for HomeBrew.

The image above shows that there is one warning after running brew doctor. After typing the command below, the warning should be gone.
sudo chown -R $(whoami) /usr/local
Installation & Setup
After installing and configuring HomeBrew, you can install MariaDB easily by running the command below. If you have MySQL installed before this, it may cause conflicts during the installation. But you can follow the instruction from the command line to resolve the problem.
brew install mariadb
From here, it tells us to start MySQL and run the command to connect MySQL
mysql -u root
But this is not correct enough. When you try the command above, no matter if you enter the password or not. It always returns you
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’
To address this problem, there is one solution that you can use.
- Run mysql.server stop to stop MySQL if it is running.
- Start the MySQL with the skip-grant-tables option. It will allow you to connect to MySQL without password.

3. Open another terminal and run mysql_secure_installation to setup your new password for MySQL and some other configuration. If you don’t want to use this tool, you can probably login to MySQL and run the command below to update the password for user root.
UPDATE mysql.user SET password=PASSWORD(‘NewUserPwd’) WHERE user=’root’;
After you finish the steps above, the MariaDB is finally good to go. Enjoy.
