Installing MariaDB Server PKG packages on macOS
Starting with MariaDB 10.2.3, a .pkg installer for macOS is available.
The .pkg installer installs MariaDB Server and, optionally, a launchd service definition to allow the OS to automatically start and manage MariaDB Server.
Installer behavior
The installer installs MariaDB Server in a subdirectory of /usr/local, and it creates "mariadb" and "mysql" symlinks in /usr/local. If there are existing files named "mysql" and "mariadb", they're moved to have an integer suffix (like mariadb.1 for example).
If there's an existing service listening on port 3306, the installer will create /usr/local/mariadb/my.cnf with skip-networking
. You can edit this file to set an alternate port for MariaDB Server to listen on, or you can remove skip-networking
if you have disabled the daemon that had bound port 3306.
MariaDB Server will place its socket file at /usr/local/mariadb/data/mariadb.sock.
After installation, your MariaDB Server instance will have a "root" user account and a user account named after the username of the user who ran the installer. Both of these accounts use the UNIX_SOCKET Authentication Plugin, which means no password is required to log in.
To log in to MariaDB as root, you will need to become root on the OS; the preferred mechanism for this is to use sudo
, like this:
sudo /usr/local/mariadb/server/bin/mariadb
If you want to be able to connect to MariaDB Server using TCP, you will need to create a new user and give it a password.
The daemon's executable is mariadbd
, not mysqld
. You should take this into account if you have scripts, tools, or workflows that look for processes named "mysqld". You can also invoke mysqld
to start the server; edit /Library/LaunchDaemons/com.mariadb.server.plist if you want to do that permanently.
launchd behavior
The installer can install a launchd service configuration. This is optional, but it is enabled by default.
The service definition causes launchd to automatically start MariaDB Server after installation and when the OS boots.
The launchd service configuration file installed by the installer is located at /Library/LaunchDaemons/com.mariadb.server.plist. The service definition file uses command-line arguments to mariadbd
to control some of its behavior. These will override changes you make in option (.cnf) files, so to change the datadir, for example, you'd need to edit the service definition file.
To stop MariaDB Server using launchd, execute launchctl stop com.mariadb.server
.