MariaDB is an opensource database management system that is widely used as an alternative to the MySQL portion of the popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. It is intended as a direct replacement for MySQL.
The short version of this installation guide consists of three steps:
Update your package index with apt
Install mariadbserver package with apt. The package also includes related tools forinteracting with MariaDB
Run the supplied security script mysql_secure_installation to restrict access to the server
Prerequisites
One Ubuntu 18.04 server installed on host or virtual machine.
Step 1 – Installing MariaDB
sudo apt update
Install the package
sudo apt install mariadb-server
check if MariaDB is running
sudo systemctl start mariadb.service
Step 2 — Configuring MariaDB
Running Security script
sudo mysql_secure_installation
Press Enter
Type N
Press Enter
Step 3 – User Authentication and Priviliges
Create New account
sudo mysql
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Flush priviliges
FLUSH PRIVILEGES;
exit
Step 4 – Testing MariaDB
sudo systemctl start mariadb
sudo systemctl status mariadb
The output shoud be similiar to this
Output
● mariadb.service - MariaDB 10.1.44 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-03-25 16:51:16 UTC; 8min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 22559 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 27 (limit: 1152)
CGroup: /system.slice/mariadb.service
└─22559 /usr/sbin/mysqld
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: mysql
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: performance_schema
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: Phase 6/7: Checking and upgrading tables
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: Processing databases
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: information_schema
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: performance_schema
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: Phase 7/7: Running 'FLUSH PRIVILEGES'
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22596]: OK
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22658]: Checking for insecure root accounts.
Mar 25 16:51:17 ubuntu-mariadb /etc/mysql/debian-start[22663]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
Try to connect database using the mysqladmin
sudo mysqladmin version
Output
mysqladmin Ver 9.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Server version 10.1.44-MariaDB-0ubuntu0.18.04.1
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/run/mysqld/mysqld.sock
Uptime: 10 min 9 sec
Threads: 1 Questions: 445 Slow queries: 0 Opens: 167 Flush tables: 1 Open tables: 30 Queries per second avg: 0.730
To create another administrative user wiht password
mysqladmin -u admin -p version
FINALE
You now have a working Docker. We tried and understood images and containers with docker commands.