Installing MariaDB on Mac OS X
One of the easiest ways to install MariaDB on Mac OS X is to use Homebrew, which is an open source package manager for that platform. Before you can install it, however, you need to prepare your system. The first thing you need to do is install Xcode—Apple's integrated development environment. It's available for free from the Mac App Store.
Once Xcode is installed, you can install brew. Full instructions are available on the Homebrew Project website at http://brew.sh but the basic procedure is to open a terminal and run the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The preceding command downloads the installer and runs it. Once the initial installation is complete, we run the following command to make sure everything is set up properly:
brew doctor
The output of the preceding command will tell us about any potential issues, along with suggestions to fix them. Once brew is working properly, we can install MariaDB with the following commands:
brew update brew install mariadb
Tip
There is no option to choose a specific MariaDB series; whatever is the current version in brew
is the one that will be installed. Also, brew
will not prompt you to set a database user password during installation, this is dangerous, so be sure to set one immediately afterwards, following the instructions in Chapter 3, Securing MariaDB.
MariaDB will not automatically be started after installation. To do so, we run the following commands:
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
To stop MariaDB, we use the unload
command, as follows:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
To learn about installing MariaDB on Linux, read on. Otherwise, skip to the After the installation section at the end of this chapter.