Skip to content
Vianney Veremme edited this page May 22, 2024 · 12 revisions

Welcome to the Database wiki!

Initialization (will be moved)

Step 1 - Installing MariaDB

Install the package:

sudo apt install mariadb-server

Step 2 - Configuring MariaDB

Ensure that MariaDB is running with the systemctl start command.

sudo mysql_secure_installation

No need to set root password, then I recommend choosing yes to all the following options.

Step 3 - Creating an Admin user

sudo mariadb
GRANT ALL ON *.* TO '<username>'@'localhost' IDENTIFIED BY '<password>' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Useful MariaDB commands

Login

Login with the following command:

mysql -u <username> -p

From a remote location:

mysql -u <username> -p -h <ip_adress>

List the databases

All the databases:

SHOW databases;

Only the created (unrequired) databases:

SELECT schema_name
FROM information_schema.schemata
WHERE schema_name NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys');

Create a new database

Select a database

USE <database>;

Show the tables

SHOW tables;

Clone this wiki locally