How to install MariaDB on Mac

Like the Wildfly Application Server installation, we will install MariaDB through Homebrew, the package management software.

Compiling MariaDB

Open a terminal and type

macbookpro$ brew update
macbookpro$ brew search mariadb

mariadb                                   mariadb-connector-c                                                                                                   
homebrew/versions/mariadb100              Caskroom/cask/navicat-for-mariadb                                                                                     
macbookpro$ brew install mariadb
==> Installing dependencies for mariadb: openssl
==> Installing mariadb dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2h_1.el_capitan.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2h_1: 1,691 files, 12M
==> Installing mariadb
==> Downloading https://homebrew.bintray.com/bottles/mariadb-10.1.15.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mariadb-10.1.15.el_capitan.bottle.tar.gz
==> /usr/local/Cellar/mariadb/10.1.15/bin/mysql_install_db --verbose --user=philippe.wanner --basedir=/usr/local/Cellar/mariadb/10.1.15 --datadir=/usr/local/var/mysql --tmpdir=/tmp
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

To connect:
    mysql -uroot

To have launchd 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:
  mysql.server start
==> Summary
🍺  /usr/local/Cellar/mariadb/10.1.15: 573 files, 137.1M

Run the MariaDB installer

macbookpro$ unset TMPDIR
macbookpro$ mysql_install_db

Then you see the following

Installing MariaDB/MySQL system tables in '/usr/local/var/mysql' ...
2016-07-03 13:37:37 140735229489152 [Note] /usr/local/Cellar/mariadb/10.1.15/bin/mysqld (mysqld 10.1.15-MariaDB) starting as process 13274 ...
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Memory barrier is not used
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Compressed tables use zlib 1.2.5
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Using SSE crc32 instructions
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Completed initialization of buffer pool
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-03 13:37:37 140735229489152 [Note] InnoDB: Waiting for purge to start
2016-07-03 13:37:37 140735229489152 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.30-76.3 started; log sequence number 1616819
2016-07-03 13:37:37 123145313034240 [Note] InnoDB: Dumping buffer pool(s) not yet started
OK
Filling help tables...
2016-07-03 13:37:39 140735229489152 [Note] /usr/local/Cellar/mariadb/10.1.15/bin/mysqld (mysqld 10.1.15-MariaDB) starting as process 13278 ...
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Memory barrier is not used
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Compressed tables use zlib 1.2.5
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Using SSE crc32 instructions
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Completed initialization of buffer pool
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-03 13:37:39 140735229489152 [Note] InnoDB: Waiting for purge to start
2016-07-03 13:37:39 140735229489152 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.30-76.3 started; log sequence number 1616829
2016-07-03 13:37:39 123145313034240 [Note] InnoDB: Dumping buffer pool(s) not yet started
OK
Creating OpenGIS required SP-s...
2016-07-03 13:37:42 140735229489152 [Note] /usr/local/Cellar/mariadb/10.1.15/bin/mysqld (mysqld 10.1.15-MariaDB) starting as process 13282 ...
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Memory barrier is not used
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Compressed tables use zlib 1.2.5
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Using SSE crc32 instructions
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Completed initialization of buffer pool
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-03 13:37:42 140735229489152 [Note] InnoDB: Waiting for purge to start
2016-07-03 13:37:42 140735229489152 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.30-76.3 started; log sequence number 1616839
2016-07-03 13:37:42 123145313034240 [Note] InnoDB: Dumping buffer pool(s) not yet started
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/local/Cellar/mariadb/10.1.15/bin/mysqladmin' -u root password 'new-password'
'/usr/local/Cellar/mariadb/10.1.15/bin/mysqladmin' -u root -h Philippes-MacBook-Pro.local password 'new-password'

Alternatively you can run:
'/usr/local/Cellar/mariadb/10.1.15/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr/local/Cellar/mariadb/10.1.15' ; /usr/local/Cellar/mariadb/10.1.15/bin/mysqld_safe --datadir='/usr/local/var/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/Cellar/mariadb/10.1.15/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from MariaDB
Corporation Ab. You can contact us about this at sales@mariadb.com.
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

Start MariaDB Server

You have two way to do this:

Run MariaDB through Homebrew

[Once] Install the brew services (if not yet done)

macbookpro$ brew tap homebrew/services
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
Checking connectivity... done.
Tapped 0 formulae (32 files, 46.2K)

Run brew service MariaDB

macbookpro$ brew services start mariadb
==> Successfully started `mariadb` (label: homebrew.mxcl.mariadb)

Note that the following brew services command also exist:

  • brew services restart mariadb
  • brew services stop mariadb

Run MariaDB in background process

macbookpro$ mysql.server start
Starting MySQL
. SUCCESS!

Use MariaDB

macbookpro$ mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.15-MariaDB Homebrew

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
Advertisements
How to install MariaDB on Mac

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s