DEV Community

Cover image for Mac installing MariaDB
Chris Bongers
Chris Bongers

Posted on • Originally published at daily-dev-tips.com

Mac installing MariaDB

Yesterday we installed MySQL on our Mac, however, you might be wondering but what about MariaDB?

MariaDB has been known to be the next step. It's highly compatible to migrate your MySQL to MariaDB.

Luckily for us, this installation process is easier than MySQL since we can use Homebrew.

Installing MariaDB on Mac

To install MariaDB we need to have Homebrew installed first.

If you don't have this installed follow my guide on installing Homebrew.

Open up your favorite terminal and execute the following command first to make sure Homebrew is up to date.

brew update
Enter fullscreen mode Exit fullscreen mode

Then we can go ahead and install MariaDB.

brew install MariaDB
Enter fullscreen mode Exit fullscreen mode

This will start a whole series of cool lines in your Terminal which makes you look like hackerman!

Hackerman gif

Once it is done, we have successfully installed MariaDB.

We can now start/stop the service using Homebrew.

brew services start mariadb
brew services stop mariadb
Enter fullscreen mode Exit fullscreen mode

Connecting to the MySQL server

Once you started the server you can run the following command to connect to our database.

mysql -uroot -p
Enter fullscreen mode Exit fullscreen mode

It will ask for your password, and if correct it will show the following.

MariaDB connection

Now we can also use a tool like TablePlus to connect to our MariaDB.

Add a new MariaDB connection using the following settings

  • host: 127.0.0.1
  • user: root
  • password: You choose this in the installation
  • port: 3306 (default)

MariaDB TablePlus connection

Help, the password is wrong

I had the issue where my password didn't work because of the running instance of MySQL. First of all, stop the running MySQL instance using the Settings => MySQL interface.

Now you can run the following command:

sudo mysql_secure_installation
Enter fullscreen mode Exit fullscreen mode

The sudo is important here to generate a new root password.
In my case, I just made it the same as what I had.

Follow the steps it prompts everything can be answered with Yes.

Now you should be able to log in again.

Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Top comments (2)

Collapse
 
madza profile image
Madza

I've seen it being mentioned a lot 😉
Tho, decided to set a goal to master PostgreSQL, first 😉

Collapse
 
dailydevtips1 profile image
Chris Bongers

Postgress is cool!
I would love to check it out, but seeing we still have legacy code on MySQL MariaDB is the closest we get to migrating.