How to install MariaDB Server on macOS using the Homebrew package manager, including starting the service and securing the installation.
MariaDB Server is available for installation on macOS via the Homebrew package manager. MariaDB Server (together with many client programs and helper tools) is available as a Homebrew "bottle", a precompiled package. If you haven't yet installed Homebrew, see this section.
Install MariaDB Server:
Start MariaDB Server:
Alternatively, and strongly recommended, automatically start MariaDB Server:
After MariaDB Server has started, you can connect to the server using the shell user name (see for information on the user):
Alternatively, connect as root:
For graphical clients you can use instead of the mariadb command-line client, see .
Update Homebrew packages:
Then upgrade MariaDB Server:
Install Homebrew like this:
Open a Terminal (⌘ + Space to open Spotlight, type Terminal).
Issue this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Alternatively, use the package installer (.pkg; at the time of writing this, )
In Homebrew, the configuration file for MariaDB is located at:
/usr/local/etc/my.cnf for Intel-based Macs.
/opt/homebrew/etc/my.cnf for Apple Silicon Macs (ARM architecture).
Find information about the MariaDB version, analytics, and more, using the brew info command:
MariaDB Server (mariadbd), the MariaDB command-line client (mariadb), and many more clients and tools are installed in /opt/homebrew/Cellar/mariadb (for Apple Silicon Macs). Find the location for your machine, as well as the MariaDB programs installed, with these commands:
To find out which user is used, issue these commands in a shell like Terminal:
If you start MariaDB automatically, a macOS background service is added. You can find the MariaDB background service in System Settings > General > Login Items & Extensions. It's named mariadbd-safe.
The toggle switch allows you to turn off the automatic start of MariaDB. This prevents MariaDB Server from automatically starting once you reboot macOS.
To review the resource usage of MariaDB Server, use this command (type q to exit topwhen done):
MariaDB doesn't offer graphical clients for working with MariaDB Server, but there are , some of which run on macOS. One of those is , a subscription-based client that has a (not too) , though.
Assuming a standard Homebrew installation of MariaDB, and assuming you connect to MariaDB Server , configure Beekeeper Studio like this:
Connection type: MariaDB
Authentication method: Username/Password
Connection mode: Socket
Socket path: /tmp/mysql.sock
Once connected to MariaDB Server, you can run queries in Beehive Studio:
The query shown in this screenshot uses a MariaDB sample database called nation which you can use to get familiar with MariaDB. See for more information.
MariaDB offers a sample database you can use to get familiar with using MariaDB. You can download it here:
Unzip nation.zip, then import the database into MariaDB Server, using this command (assuming you downloaded and unzipped the sample database in the Downloads folder):
When done, use that database in the mariadb command-line client, like this:
Alternatively, open the database in .
In addition to the "bottled" MariaDB Server package available from Homebrew, you can use Homebrew to build MariaDB from source. This is useful if you want to use a different version of the server or enable some different capabilities that are not included in the bottle package.
Two components not included in the bottle package are the CONNECT and OQGRAPH engines, because they have non-standard dependencies. To build MariaDB Server with these engines, you must first install boost and judy. Follow these steps to install the dependencies and build the server:
You can also use Homebrew to build and install a pre-release version of MariaDB Server. Use this command to build and install a "development" version of MariaDB Server:
(video)
This page is licensed: CC BY-SA / Gnu FDL
brew install mariadbmysql.server startbrew services start mariadbRefer to the Homebrew website for more information, particularly to the Homebrew documentation.
Username: (name of the shell user, without the @localhost suffix)



mariadbsudo mysql -u rootbrew updatebrew upgrade mariadb~> brew info mariadb
==> mariadb: stable 12.1.2 (bottled)
Drop-in replacement for MySQL
https://mariadb.org/
...
To restart mariadb after an upgrade:
brew services restart mariadb
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/mariadb/bin/mariadbd-safe --datadir\=/opt/homebrew/var/mysql
==> Analytics
install: 6,319 (30 days), 12,735 (90 days), 62,444 (365 days)
install-on-request: 6,291 (30 days), 12,670 (90 days), 62,137 (365 days)
build-error: 8 (30 days)~> which mariadb
/opt/homebrew/bin/mariadb # in the next command, use this location to cd to
~> cd /opt/homebrew/bin/; ls -1 maria*
mariabackup
mariadb
mariadb-access
...
mariadbd
mariadbd-multi
mariadbd-safe
mariadbd-safe-helper~> users
myuser
~> mariadb -e "SELECT USER()"
+------------------+
| USER() |
+------------------+
| myuser@localhost |
+------------------+top -pid $(pgrep mariadbd)mariadb < Downloads/nation.sql~> mariadb nation
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 12.1.2-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 [nation]> SHOW TABLES;
+-------------------+
| Tables_in_nation |
+-------------------+
| continents |
| countries |
| country_languages |
| country_stats |
| guests |
| languages |
| region_areas |
| regions |
| vips |
+-------------------+
9 rows in set (0.001 sec)brew install boost judy
brew install mariadb --build-from-sourcebrew install mariadb --devel