MariaDb
Install
$ brew install mariadb
⋮
==> Caveats
==> mariadb
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
MySQL is configured to only allow connections from localhost by default
To start mariadb now and restart at login:
brew services start 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
Show the version:
$ mysql --version
mysql from 12.2.2-MariaDB, client 15.2 for osx10.21 (arm64) using EditLine wrapper
Initialize for production use:
$ sudo mariadb-secure-installation
Start the service:
$ brew services start mariadb
==> Successfully started `mariadb` (label: homebrew.mxcl.mariadb)
$ sudo dnf install mariadb-server
Check the version:
$ mysql --version
mysql Ver 15.1 Distrib 10.3.28-MariaDB, for Linux (x86_64) using readline 5.1
Enable the server:
$ sudo systemctl enable mariadb --now
$ sudo apt install mariadb-server
Check the version:
$ mysql --version
mysql Ver 15.1 Distrib 10.6.21-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
Initialize:
$ sudo mysql_secure_installation
Usage
Show version
In mysql client:
SELECT version();
Show users
In mysql client:
SELECT user FROM mysql.user;
Troubleshoot
Bind address
On Ubuntu 22.04, the default binding address is 127.0.0.1. Change it by edit file /etc/mysql/mariadb.conf.d/50-server.cnf:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
-bind-address = 127.0.0.1
+bind-address = 0.0.0.0
#
# * Fine Tuning
Then restart the service:
$ sudo systemctl restart mariadb
Reinstall database
In case you want to completely wipe out the data, clear the data dir (default to /var/lib/mysql):
$ sudo rm -rf /var/lib/mysql/*
Then do this:
$ sudo mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
2025-05-12 16:09:53 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
OK
To start mariadbd at boot time you have to copy
support-files/mariadb.service to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mariadbd-safe --datadir='/var/lib/mysql'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/share/mysql/mysql-test' ; perl mariadb-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/