Installing MariaDB Database Server on macOS

MariaDB is an alternative to MySQL database which is more performant with a full open license, you can install it easily on macOS via Homebrew.

The first step is to install Homebrew on your computer and possibly to remove any older MySQL database server versions.

Once Homebrew is installed, on the command line:

brew install mariadb

Then start the server:

mysql.server start

To automatically start the MariaDB Server every time on restart (also known as a background service):

brew services start mariadb

To login as root (no password is initially set):

sudo mysql -u root

or just:


When MariaDB starts on the command line you are entered into an interactive session, you will also see the database version, to exit the session use keys control+c to exit.

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 4

Server version: 10.5.9-MariaDB Homebrew

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

For more info on the MariaDB install you can also run:

brew info mariadb

To update MariaDB

brew upgrade mariadb

To remove MariaDB

brew remove mariadb
brew cleanup

phpMyAdmin Authentication

If you are using phpMyAdmin locally, you will need to create a database user and password as MariaDB uses ‘sudo’ to login as root on the command line – but if you use root & no password in phpMyadmin it will not authenticate.

Login to mysql via command line:

sudo mysql -uroot

Create a user for phpmyadmin, change username and password to suit:

CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;

Use that for phpMyadmin access.