Introduction – MariaDB is a free and open source database management system. It acts as a drop replacement for Oracle MySQL server. It is a community drive and developed branch of Oracle MySQL. MariaDB is a multi-user, multi-threaded SQL database server. This page explains how to install the latest stable version of MariaDB on RHEL 8 server.
How to install MariaDB on RHEL 8
The procedure to install MariaDB on a Red Hat Enterprise Linux 8 is as follows:
- Open the terminal application. Another option is to log in using the ssh commandssh user@rhel-8-server-ip
- Installing the MariaDB on RHEL 8, type:
sudo yum install mariadb-server - Securing the MariaDB server in RHEL 8, run:
sudo mysql_secure_installation - Finally test your installation by running:
mysql -u root -p
Let us see all steps in details.
Installing MariaDB on RHEL 8 using the yum command
Type the following yum command:
$ sudo yum install mariadb-server
How to enable mariadb.service at RHEL 8 boot time
Run the following systemctl command:
$ sudo systemctl enable mariadb.service
Created symlink /etc/systemd/system/mysql.service ? /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/mysqld.service ? /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service ? /usr/lib/systemd/system/mariadb.service.
How to start/stop/restart mariadb.service on RHEL 8
Again use the following syntax:
$ sudo systemctl stop mariadb.service
$ sudo systemctl start mariadb.service
$ sudo systemctl restart mariadb.service
$ sudo systemctl status mariadb.service
How to secure the MariaDB Server on RHEL 8
You must secure the MariaDB server by running the following command for production use:
$ sudo mysql_secure_installation
Securing the MariaDB Server
How do I log in to the MariaDB server?
Use the mysql command as follows:
$ mysql -u root -p
Testing the MariaDB server installation
How to add database on the MariaDB server
First, log in as root user:
$ mysql -u root -p mysql
Create a new MariaDB database called nixcraft. Type the following command at MariaDB> prompt:
CREATE DATABASE nixcraft;
How to add users on the MariaDB server
Create a new user called vivek for database called nixcraft:
GRANT ALL ON nixcraft.* TO vivek@localhost IDENTIFIED BY 'secretePasswordHere';
How to connect to the MariaDB database nixcraft using vivek account
$ mysql -u vivek -p'secretePasswordHere' nixcraft
OR
$ mysql -u vivek -p nixcraft
For further information see:
- Create a MySQL Database, Tables and Insert Data
- Mysql User Creation: Setting Up a New MySQL User Account
- How to delete or remove a MySQL/MariaDB user account on Linux/Unix
Conclusion
You completed and secured MariaDB on RHEL 8 server. Further, you learned how to create users and databases on the MariaDB server. For more info see MariaDB site here and recommended MariaDB books here.
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |