The difficult task of installing MariaDB on Mac OS

Kesia Feitosa
3 min readMar 3, 2021

I hope this article help you to solve problems during the MariaDB installation. This article contains the installation guide for Homebrew and MariaDB that I used and the solution for errors that I faced.

First step was to install Homebrew to be able to install MariaDB by homebrew. My OS version is Catalina 10.5.7 and to install Homebrew I followed the guide on the link:

https://treehouse.github.io/installation-guides/mac/homebrew

As soon the installation started I got the error message with formulae:

I had to uninstall node.js manually to solve the problem. I deleted all files related to node and npm using the terminal following the steps described on the link below. After that, I was able to install Homebrew successfully.

I was following the homebrew guide installation, I ran brew doctor and during the check a warning that prompts to update the system, which gave me the option to update from Software Update in System Preferences or run:
Run softwareupdate — all — install — force
I ran it and when the update completed, the system was restarted.

Therefore, I was able to instal MariaDB by homebrew.

When I arrived at this point I was very confident that I would be able to install MariaDB on my mac. I ran the command and I followed on-screen instructions:
Run brew install mariadb

However, after the installation was completed as soon as I started MariaDB, I had problem when I tried to run the secure installation:
Run mysql.server start
Run mariadb-secure-installation

I got the error message Access denied for user 'root@localhost' when I entered the password. I followed the instructions to press enter and it didn't work. I found several articles that said to only press enter, others said to enter 'N', 'NO', but all attempts were unsuccessful.

What worked for me it was to change the password in the database. Then, I ran the command to connect and I ran the sql that worked for my mac, take a look at what I did:

Run sudo mysql -u root -p
Enter password:
Run MariaDB [(none)]> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘<yourPassword>’);

As a result, I managed to log in and I was able to configure the secure installation.

Finally, MariaDB was ready to use.

I found this solution to solve this problem on Stackoverflow:
https://stackoverflow.com/questions/21944936/error-1045-28000-access-denied-for-user-rootlocalhost-using-password-y

Thank you for reading. Please share it, if you enjoyed it.

--

--

Kesia Feitosa

Bachelor of Computer Science. Java programmer. Spreading knowledge is the key to learning