MariaDB Macbook Installation Guide

Open Terminal

  • Go to Applications and type “Terminal” or Press Command + Space, type Terminal, press Enter.
  • Check if Xcode Command Line Tools are installed, usually homebrew requires a couple of things like git, bash and curl before installation

xcode-select --version
Copy

  • If you see xcode-select: version 2397 (or any number), you’re good. If you get an error, install it:

xcode-select --install
Copy

Install Homebrew (Based from https://brew.sh/)

  • Copy the command at the site or copy and paste the one below:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Copy
  • Paste to the command line in the terminal and press enter
  • Enter your Macbook Password and press enter. Usually you won’t see anything. 
  • Wait to be installed
 

Add Homebrew to your PATH – Note : Not sure which Mac you have? Click the Apple logo → About This Mac. If it says Apple M1/M2/M3/M4, use the first set. If it says Intel, use the second.

 
  • For Apple Silicon (M1/M2/M3/M4):

echo >> ~/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Copy
  • For Intel Mac:

echo >> ~/.zprofile
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
Copy
  • Close and Reenter Terminal
  • Check if brew works

brew doctor
Copy Install Maria DB (Based from https://mariadb.com/kb/en/installing-mariadb-on-macos-using-homebrew/)

  • Copy and Paste to the command line in the terminal, press enter every command

brew install MariaDB
mysql.server start
brew services start MariaDB
mysql
Copy
  • Create database in the command line. Note: yourDB is your database name, type it without ‘ ‘.

CREATE DATABASE 'yourDB';
Copy
  • Check if your database has been created

SHOW DATABASES;
Copy
  • Create your user and password. Note the ‘ ‘ before and after your username is IMPORTANT.

CREATE USER 'yourname'@localhost IDENTIFIED by 'password123';
Copy
  • Check if the user has been created

SELECT User FROM mysql.user;
Copy
  • Give your user access to your new database. Note :  “*.*” means giving access to your user to ALL EXISTING DATABASE

GRANT ALL PRIVILEGES ON *.* TO 'yourname'@localhost;
Copy
  • Check what ACCESS your newly created user have

SHOW GRANTS For 'yourname'@localhost;
Copy
← Back to all tutorials