Show Menu
Cheatography

Mariadb Cheat Sheet (DRAFT) by

Linux commands to install and manage Mariadb

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Install Mariad­b-S­erver

sudo apt install mariad­b-s­erver
sudo mysql_­sec­ure­_in­sta­llation
sudo mariadb
CREATE DATABASE exampl­e_d­ata­base;
ALTER DATABASE test CHARACTER SET='utf8' COLLAT­E='­utf­8_bin';
GRANT ALL ON exampl­e_d­ata­base.* TO 'examp­le_­use­r'@­'lo­cal­host' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVIL­EGES;
exit
sudo mariadb
mariadb -u exampl­e_user -p
SHOW DATABASES;

Basic Mariadb Commands

Log into DB
sudo systemctl enable mysql
 
sudo systemctl restart mysql
 
sudo mysql -u root -p

Basic Queries

select user from mysql.u­ser;
| displays all database users
show grants for 'zabbi­x'@­'lo­cah­osts'
| displays user privileges
set password for 'zabbi­x'@­'lo­calhost = password ('zabb­ix');