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 - If you see xcode-select: version 2397 (or any number), you’re good. If you get an error, install it:
xcode-select --install 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)" - 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)" - For Intel Mac:
echo >> ~/.zprofile
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/bin/brew shellenv)" - Close and Reenter Terminal
- Check if brew works
brew doctor - 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 - Create database in the command line. Note: yourDB is your database name, type it without ‘ ‘.
CREATE DATABASE 'yourDB'; - Check if your database has been created
SHOW DATABASES; - Create your user and password. Note the ‘ ‘ before and after your username is IMPORTANT.
CREATE USER 'yourname'@localhost IDENTIFIED by 'password123'; - Check if the user has been created
SELECT User FROM mysql.user; - 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; - Check what ACCESS your newly created user have
SHOW GRANTS For 'yourname'@localhost; Install TablePlus (Because HeidiSQL does not work on some Mac)
- Go to https://tableplus.com
- Click “Download for Mac and Install As is
- Connect your MariaDB to TablePlus by
- Clicking the Plus Sign and Select MariaDB
- Fill out the details below
-
- Name – (Connection Name, put anything)
-
- User – yourname (The username your created, before @localhost)
-
- Password – password123 (Password you set after the “IDENTIFIED BY”)
-
- Database – yourDB (Database name you created)
-
- HOST – Make sure it is 127.0.0.1 that means it is localhost
- Connect
- Add Tables
-
- Once you connected the TablePlus to your MariaDB, there is a Plus Sign at the lower right corner
Note : You can also Create Table using Command Line, check https://www.w3schools.com/sql/sql_create_table.asp for syntax