Skip to content
Runbook

Install MariaDB on macOS

Open source SQL database, a community-developed drop-in replacement for MySQL.

Databasesqlrdbmsrelationaldatabaseacidmysql-compatible

Installation

Server (Homebrew) · Homebrew
brew install mariadb

Installs the MariaDB server and client (mariadb, mariadbd).

Verify the installation

Verify
mariadb --version

Service

Start
brew services start mariadb
Stop
brew services stop mariadb
Status
brew services info mariadb
Restart
brew services restart mariadb

Important files

TypePathDescription
config/opt/homebrew/etc/my.cnfMain configuration file (Apple Silicon; /usr/local/etc on Intel).
data/opt/homebrew/var/mysqlData directory (Apple Silicon; /usr/local/var/mysql on Intel).

Default ports

3306

Command-line tools

  • mariadbInteractive SQL client (mysql is kept as a symlink).
  • mariadbdThe database server daemon.
  • mariadb-adminAdministrative client (status, shutdown, password).
  • mariadb-secure-installationHardening script: set the root password, remove test data.

Uninstall

Uninstall
brew services stop mariadb
brew uninstall mariadb

The /opt/homebrew/var/mysql data directory may remain; delete it manually to wipe everything.

Good to know

  • Homebrew's mariadb starts with no root password: run mariadb-secure-installation to set one.
  • The /opt/homebrew paths are for Apple Silicon; on Intel use /usr/local. Check with brew --prefix.

Installation with Homebrew

brew install mariadb installs the server (mariadbd) and client (mariadb). Start it as a background service with brew services start mariadb. The configuration is /opt/homebrew/etc/my.cnf and the data lives under /opt/homebrew/var/mysql (Apple Silicon; /usr/local on Intel).

Securing the installation

Homebrew's MariaDB starts without a root password. Run mariadb-secure-installation right away to set one, remove anonymous accounts, and drop the test database. Then connect with mariadb -u root -p.

MySQL compatibility

The classic mysql command is provided as a symlink to mariadb, so existing scripts and clients keep working. If you already ran MySQL via Homebrew, uninstall it first — both engines listen on port 3306 and cannot run at the same time.