Table of Contents PrerequisitesIntroduction to MariaDB and HomebrewUnderstanding Requirements of MariaDB Mac InstallationWhat are the MariaDB Mac Installation Steps?1) Xcode Installation2) Homebrew Installation3) Homebrew Verification4) Updating Homebrew5) MariaDB Verification on Homebrew Repo6) MariaDB Installation7) Running the Database Installer8) Starting MariaDB9) Securing Installation10) Connecting to MariaDBConclusionFrequently Asked Questions Try Hevo for Free Share Share To LinkedIn Share To Facebook Share To X Copy Link MariaDB is an extremely popular open-source database management system. The platform is known to maintain high compatibility with MySQL. If you did not already know this, then you will be glad to know that the MariaDB Server can be easily installed on macOS with the help of the HomeBrew package manager. From system requirements to a detailed guide on the installation process, you will find all relevant information to effectively install MariaDB on macOS. All you need to do is check your system compatibility and match the system requirements for MariaDB Mac installation and then follow the steps listed in this article. Table of Contents PrerequisitesIntroduction to MariaDB and HomebrewUnderstanding Requirements of MariaDB Mac InstallationWhat are the MariaDB Mac Installation Steps?1) Xcode Installation2) Homebrew Installation3) Homebrew Verification4) Updating Homebrew5) MariaDB Verification on Homebrew Repo6) MariaDB Installation7) Running the Database Installer8) Starting MariaDB9) Securing Installation10) Connecting to MariaDBConclusionFrequently Asked Questions Prerequisites Working knowledge of MariaDB and Mac OS. Working knowledge of Linux command line. Introduction to MariaDB and Homebrew Now, Homebrew also allows you to use MariaDB 10.4, 10.3, 10.2, and 10.1 for macOS. You can upgrade to the MariaDB Server and remove all old MySQL server installs on macOS without any conflicts. It can be complicated to install MariaDB on macOS when you have a variety of old installs of MySQL servers on your system. This is where Homebrew can be very useful for the installation and up-gradation of MariaDB and utilizing it as a replacement for MySQL. The MariaDB Server is now available as a Homebrew “bottled” pre-compiled package. This means that you can install it without any needing to build from the source. It can save a lot of time and hassles. Along with the Homebrew “bottled” MariaDB server package, you can also install MariaDB on macOS from the source. This is useful for someone who needs a different version of MariaDB or needs to enable some different functionalities that cannot be found in the bottle package. The components that cannot be found in the bottle package are the CONNECT and OQGRAPH engines because they have non-standard dependencies. In this tutorial, you will learn the steps to install MariaDB on macOS in complete and comprehensive detail. To know more about MariaDB, visit this MariaDB’s Official Website. Effortless Data Sync: Master MariaDB Replication for Real-Time Insights! Keep your data in sync with ease using MariaDB replication! Enable real-time data sharing across servers, enhance database availability, and ensure seamless disaster recovery. Discover how replication can power your data strategy with continuous, reliable data flow. Use Hevo for: Simple two-step method for replicating MariaDB data. Performing pre/post load transformations using drag-and-drop features. Real-time data sync to get analysis-ready data. Experience the simplicity of data integration with Hevo and see how Hevo helped fuel Cure.Fit drive for accurate analytics and unified data. Get Started with Hevo for Free Understanding Requirements of MariaDB Mac Installation There are a few things you need to check into before you start installing MariaDB on macOS. There are a few prerequisites that are crucial for this installation process and the checklist below lists everything you need, to effortlessly complete the installation of MariaDB on macOS. You can take a look at the following checklist of requirements to ensure that you don’t face any discrepancies at a later stage. Make sure you are operating on the macOS platform. You need to log in as an administrator on your system terminal. You need to install Xcode before you start the installation process. Xcode is an integrated development environment from Apple and it is available on the Mac App Store free of cost. After you have installed Xcode, you need to install the Homebrew on your system. When you have Homebrew on your system, you will also need to check Homebrew and update the local repository index of the Homebrew package installer if needed. You can also choose to backup all your current databases with the help of mysqldump. It allows you to backup all your MySQL user permissions. Make sure you know and understand your permissions when you remove an existing database. You will also need to remove MySQL from everywhere it has been inserted into your OS X system. You can either move the folders to a backup folder instead of removing them, or you can remove MySQL completely to avoid any conflicts later on. If you have all the above points checked on your system, then you can easily install the MariaDB Server on macOS following the tutorial below. What are the MariaDB Mac Installation Steps? Once again, before you learn how to install the MariaDB server on macOS this article will talk about the steps to fulfill some of the prerequisites on your system. After that, you will look into the process of installation of MariaDB on macOS. Here is the list of steps that you’ll be exploring in the following sections: Xcode Installation Homebrew Installation Homebrew Verification Updating Homebrew MariaDB Verification on Homebrew Repo MariaDB Installation Running the Database Installer Starting MariaDB Securing Installation Connecting to MariaDB 1) Xcode Installation Run: xcode-select --install. $ xcode-select --install xcode-select: note: install requested Integrate MariaDB to Azure Synapse AnalyticsGet a DemoTry itIntegrate MariaDB to BigQueryGet a DemoTry itIntegrate MariaDB to DatabricksGet a DemoTry it 2) Homebrew Installation To install Homebrew, the basic procedure to follow is to simply open a terminal and run the following command: Run: ruby -e "$(curl-fsSL <a href="https://raw.githubusercontent.com/Homebrew/install/master/install)"" class="rank-math-link">https://raw.githubusercontent.com/Homebrew/install/master/install)"</a> Or, Run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)". $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew ==> The following new directories will be created: /usr/local/sbin /usr/local/Caskroom You can press RETURN to continue or any other key to abort Password: ==> /usr/bin/sudo /bin/mkdir -p /usr/local/sbin /usr/local/Caskroom ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/sbin /usr/local/Caskroom ==> /usr/bin/sudo /usr/sbin/chown rob /usr/local/sbin /usr/local/Caskroom ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/sbin /usr/local/Caskroom ==> Downloading and installing Homebrew... remote: Enumerating objects: 5822, done. remote: Counting objects: 100% (5822/5822), done. remote: Compressing objects: 100% (43/43), done. remote: Total 24553 (delta 5779), reused 5821 (delta 5779), pack-reused 18731 Receiving objects: 100% (24553/24553), 7.33 MiB | 1.09 MiB/s, done. Resolving deltas: 100% (18413/18413), completed with 1257 local objects. ... HEAD is now at 67d1bc6fb Merge pull request #7615 from Bo98/test-dep-satisfied ==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz ######################################################################## 100.0% ==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz Updated 1 tap (homebrew/core). ==> New Formulae ... ==> Renamed Formulae ... ==> Deleted Formulae ... ==> Installation successful! Analytics data hasn’t been sent yet (or will be during this `install` run). ==> Next steps: - Run `brew help` to get started. For further guidance visit the Homebrew Project Website or read the further documentation. 3) Homebrew Verification You will need to follow the instructions displayed on the screen to fix any warnings shown. $ brew doctor Leaving kegs unlinked can cause build trouble and cause the failure of brews that depend on those kegs to run properly once built. Run `brew link` on these: gettext git Warning: Some installed formulae are missing dependencies. You should `brew install` the missing dependencies: brew install openssl@1.1 Run `brew missing` for more details. $ brew link gettext git Linking /usr/local/Cellar/gettext/0.19.8.1... 187 symlinks created Linking /usr/local/Cellar/git/2.19.1... Error: Could not symlink bin/git Target /usr/local/bin/git already exists. You may want to remove it: rm '/usr/local/bin/git' To overwrite all conflicting files and force the link: brew link --overwrite git To list all files that would be deleted: brew link --overwrite --dry-run git 4) Updating Homebrew Run: brew update. $ brew update Already up-to-date. 5) MariaDB Verification on Homebrew Repo Before you install MariaDB, you will have to verify the MariaDB version. Run: brew info MariaDB. $ brew info mariadb mariadb: stable 10.4.13 (bottled) Drop-in replacement for MySQL https://mariadb.org/ Conflicts with: mariadb-connector-c (because both install plugins) MySQL (because mariadb, MySQL, and percona install the same binaries) mytop (because both install `mytop` binaries) percona-server (because mariadb, MySQL, and percona install the same binaries) /usr/local/Cellar/mariadb/10.2.14 (641 files, 168.6MB) Poured from the bottle on 2018-04-30 at 11:34:15 /usr/local/Cellar/mariadb/10.3.10 (652 files, 173.3MB) * Built from source on 2018-10-12 at 07:16:37 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mariadb.rb ==> Dependencies Build: cmake ✘, pkg-config ✘ Required: groonga ✘, openssl@1.1 ✔ ==> Caveats A Homebrew-built server might face troubles while starting up due to a "/etc/my.cnf" from another install that may interfere with it. MySQL only allows connections from localhost by default To have launched start MariaDB now and restart at login: brew services start MariaDB Or, you can just run the following command if you don’t need/want a background service: MySQL.server start ==> Analytics install: 15,161 (30 days), 36,985 (90 days), 172,584 (365 days) install-on-request: 14,780 (30 days), 36,286 (90 days), 168,365 (365 days) build-error: 0 (30 days) Before you install MariaDB you need to carry out a few additional instructions: Backing up Your Data With MySQLdump $ MySQLdump -uroot -p --all-databases --flush-logs --master-data=2 > all_databases.sql Backing up Your MySQL User Permissions $ MySQLdump -uroot -p MySQL > MySQL.sql Checking Where is MySQL running on Your System $ which MySQL You will see something like: /usr/local/MySQL Now, you will have to stop the database server: $ sudo /usr/local/MySQL/support-files/MySQL.server stop Next, you will have to move, backup or remove the following folders/files: sudo rm /usr/local/MySQL sudo rm -rf /usr/local/MySQL* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* rm -rf ~/Library/PreferencePanes/My* edit /etc/hostconfig and remove the line MySQLCOM=-YES- Although these files may not exist, if you find them after checking, you have to remove them. It will prevent any conflicts with other versions of MySQL: sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /private/var/db/receipts/*MySQL* Migrate Data seamlessly Within Minutes! Start For Free No credit card required 6) MariaDB Installation Here is an instance of the code snippet you would be running: Run: brew install MariaDB. Now you will have to follow the on-screen instructions and upgrade if it is necessary to upgrade a previously installed version. $ brew install mariadb Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae fonttools ==> Downloading https://homebrew.bintray.com/bottles/mecab-0.996.mojave.bottle.3.tar.gz ==> Downloading from https://akamai.bintray.com/ef/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/mecab-ipadic-2.7.0-20070801.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/30/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/msgpack-3.2.1.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/3b/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/pcre-8.44.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/ed/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/groonga-10.0.2.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/df/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/mariadb-10.4.13.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/e4/[...]?__gda__=exp=1590016 ######################################################################## 100.0% Error: mariadb 10.3.10 is already installed To upgrade to 10.4.13, run `brew upgrade MariaDB. $ brew upgrade mariadb ==> Upgrading 1 outdated package: mariadb 10.3.10 -> 10.4.13 ==> Upgrading mariadb 10.3.10 -> 10.4.13 ==> Downloading https://homebrew.bintray.com/bottles/cmake-3.17.2.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/ed/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2_3.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/0d/[...]?__gda__=exp=1590016 ######################################################################## 100.0% ==> Downloading https://homebrew.bintray.com/bottles/mecab-0.996.mojave.bottle.3.tar.gz Already downloaded: /Users/rob/Library/Caches/Homebrew/downloads/[...]--mecab-0.996.mojave.bottle.3.tar.gz ==> Downloading https://homebrew.bintray.com/bottles/mecab-ipadic-2.7.0-20070801.mojave.bottle.tar.gz Already downloaded: /Users/rob/Library/Caches/Homebrew/downloads/[...]--mecab-ipadic-2.7.0-20070801.mojave.bottle.tar.gz ==> Downloading https://homebrew.bintray.com/bottles/msgpack-3.2.1.mojave.bottle.tar.gz Already downloaded: /Users/rob/Library/Caches/Homebrew/downloads/[...]--msgpack-3.2.1.mojave.bottle.tar.gz ==> Downloading https://homebrew.bintray.com/bottles/pcre-8.44.mojave.bottle.tar.gz Already downloaded: /Users/rob/Library/Caches/Homebrew/downloads/[...]--pcre-8.44.mojave.bottle.tar.gz ==> Downloading https://homebrew.bintray.com/bottles/groonga-10.0.2.mojave.bottle.tar.gz Already downloaded: /Users/rob/Library/Caches/Homebrew/downloads/[...]--groonga-10.0.2.mojave.bottle.tar.gz ==> Downloading https://downloads.mariadb.com/MariaDB/mariadb-10.4.13/source/mariadb-10.4.13.tar.gz ######################################################################## 100.0% ==> Installing dependencies for mariadb: cmake, pkg-config, mecab, mecab-ipadic, msgpack, pcre and groonga ==> Installing mariadb dependency: cmake ==> Pouring cmake-3.17.2.mojave.bottle.tar.gz ==> Caveats Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/cmake ==> Summary 🍺 /usr/local/Cellar/cmake/3.17.2: 6,156 files, 58.1MB ==> Installing mariadb dependency: pkg-config ==> Pouring pkg-config-0.29.2_3.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 623.6KB ==> Installing mariadb dependency: mecab ==> Pouring mecab-0.996.mojave.bottle.3.tar.gz 🍺 /usr/local/Cellar/mecab/0.996: 20 files, 4.2MB ==> Installing mariadb dependency: mecab-ipadic ==> Pouring mecab-ipadic-2.7.0-20070801.mojave.bottle.tar.gz ==> Caveats To enable mecab-ipadic dictionary, add to /usr/local/etc/mecabrc: dicdir = /usr/local/lib/mecab/dic/ipadic ==> Summary 🍺 /usr/local/Cellar/mecab-ipadic/2.7.0-20070801: 16 files, 50.6MB ==> Installing mariadb dependency: msgpack ==> Pouring msgpack-3.2.1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/msgpack/3.2.1: 757 files, 5.2MB ==> Installing mariadb dependency: pcre ==> Pouring pcre-8.44.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/pcre/8.44: 204 files, 5.5MB ==> Installing mariadb dependency: groonga ==> Pouring groonga-10.0.2.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/groonga/10.0.2: 886 files, 39.5MB ==> Installing mariadb ==> cmake . -DMySQL_DATADIR=/usr/local/var/MySQL -DINSTALL_INCLUDEDIR=include/MySQL -DINSTALL_MANDIR=share/man -DINSTALL_DOCDIR=share/d ==> make ==> make install ==> Not running post_install as the user is building a bottle You can run it manually using `brew postinstall mariadb` ==> Caveats A Homebrew-built server might face troubles while starting up due to a "/etc/my.cnf" from another install that may interfere with it. MySQL only allows connections from localhost by default To have launched start MariaDB now and restart at login: brew services start MariaDB Or, you can just run the following command if you don’t need/want a background service: MySQL.server start ==> Summary 🍺 /usr/local/Cellar/mariadb/10.4.13: 737 files, 170.0MB, built in 8 minutes 53 seconds Removing: /usr/local/Cellar/mariadb/10.2.14... (641 files, 168.6MB) Removing: /usr/local/Cellar/mariadb/10.3.10... (652 files, 173.3MB) Removing: /Users/rob/Library/Caches/Homebrew/mariadb--10.3.10.tar.gz... (67.2MB) ==> Checking for dependents of upgraded formulae... ==> No dependents found! ==> Caveats ==> cmake Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/cmake ==> mecab-ipadic To enable mecab-ipadic dictionary, add to /usr/local/etc/mecabrc: dicdir = /usr/local/lib/mecab/dic/ipadic ==> mariadb A Homebrew-built server might face troubles while starting up due to a "/etc/my.cnf" from another install that may interfere with it. MySQL only allows connections from localhost by default To have launched start MariaDB now and restart at login: brew services start MariaDB Or, you can just run the following command if you don’t need/want a background service: MySQL.server start 7) Running the Database Installer After the installation process is completed, you will have to install the database. Run: MySQL_install_db. Now you will have to follow the on-screen instructions and upgrade if it is necessary to upgrade a previously installed version. $ MySQL_install_db WARNING: The host 'robs-MacBook-Pro-2.local' could not be looked up with /usr/local/Cellar/mariadb/10.4.13/bin/resolveip. This could mean that your libc libraries may not be 100% compatible with this binary MariaDB version. The MariaDB daemon, MySQL, should work normally with the exception that hostname resolving will not work. Therefore you should use IP addresses to replace hostnames when specifying MariaDB privileges! MySQL.user table already exists! Run MySQL_upgrade, not MySQL_install_db $ MySQL_upgrade Phase 1/7: Checking and upgrading MySQL database Processing databases ... Phase 7/7: Running 'FLUSH PRIVILEGES' OK 8) Starting MariaDB Here is an example of the code snippet that will be used to start MariaDB: MariaDB will not start automatically after installation. To do so, you will first have to start the MySQL server. Run: MySQL.server start. $ MySQL.server start Starting MySQL . SUCCESS! Then, follow the following commands: Run: ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist To stop MariaDB, use the unload command. Run: launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist 9) Securing Installation The installer will not set a password for the root user by default. Right after getting MariaDB running on Mac OS, run the MySQL_secure_installation script. To install MariaDB 10.4.6 or later: Run: MariaDB-secure-installation. For installing an earlier version of MariaDB: Run: MySQL_secure_installation. If you are not sure about using unix_socket, do not enable it when asked. You can set a root password even if the on-screen instructions tell you it is safe without it. $ MySQL_secure_installation To log into MariaDB to secure it, you'll need the current password for the root user. If you've just installed MariaDB, you should just press enter here if you haven't set the root password yet. Enter current password for root (enter for none): Using the unix_socket or setting the root password ensures that nobody can log into the MariaDB root user without the proper authentication and authorization. Enable unix_socket authentication? [Y/n] n ... skipping. Since you already have your root account protected you can safely go ahead and answer 'n'. Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! MariaDB installation has an anonymous user that allows anyone to log into MariaDB without having to have a user account created for them by default. This is meant to make the installation go a bit smoother and for testing purposes. Before shifting to a production environment you should remove them. Remove anonymous users? [Y/n] y ... Success! Normally, the root should only be allowed to connect from 'localhost.’ This ensures that someone cannot guess the root password from the network. Disallow root login remotely? [Y/n] y ... Success! MariaDB comes with a database named 'test' that can be accessed by anybody by default. This is meant for testing purposes and before shifting to a production environment you should remove them. Remove the test database and access it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! You can ensure that all changes made so far will take effect immediately by reloading the privilege tables. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you're done with all the steps mentioned so far, your MariaDB installation should now be secure. Thanks for using MariaDB! Solve your data replication problems with Hevo’s reliable, no-code, automated pipelines with 150+ connectors.Get your free trial right away! 10) Connecting to MariaDB Run: MariaDB -u root -p. If you’ve installed an older version of MariaDB you may need to use “MySQL -u root -p” in the above command. $ MariaDB -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with; or g. Your MariaDB connection id is 52 Server version: 10.4.13-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 [(none)]> After the installation of the new MariaDB server, you can restore the MySQL database. Run: $ MySQL -uroot -p MySQL < MySQL.sql You also have to ensure that you flush privileges for the new user permissions to take effect. Run: FLUSH PRIVILEGES Conclusion Installing MariaDB on your Mac opens up a world of database management possibilities, whether you’re working on a new project or exploring open-source databases. By following this guide, you now have MariaDB up and running, ready to handle your data needs efficiently. With its rich features and compatibility, MariaDB is a robust choice for developers and database enthusiasts alike. If you’re looking to take your data management even further, consider using a platform like Hevo, which integrates seamlessly with MariaDB and over 150 other sources to streamline your data workflows. Sign up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs. Frequently Asked Questions 1. How do I install MariaDB on my Mac? You can install MariaDB on a Mac using Homebrew. Run the following command in your terminal:brew install mariadb 2. How to install MariaDB step by step? -Install Homebrew if not already installed.-Run brew install mariadb to install.-Start MariaDB with brew services start mariadb.-Verify the installation with mysql -u root. 3. Where does Brew install MariaDB? Homebrew installs MariaDB typically in /usr/local/Cellar/mariadb/, and symlinks it to /usr/local/bin/. Bhavik Soni Technical Content Writer, Hevo Data Bhavik is a seasoned writer in the data industry, renowned for crafting insightful and captivating content on data science. He skillfully combines his analytical prowess with his writing, transforming intricate subjects into easily understandable and engaging material for his readers. Liked the content? Share it with your connections. Share To LinkedIn Share To Facebook Share To X Copy Link Related Articles MariaDB Foreign Key: A Comprehensive Guide 101 MariaDB vs MongoDB | 10 Critical Differences What’s the Difference Between MariaDB vs PostgreSQL Moving Data from MariaDB to SQL Server Using 6 Easy Methods