How to Install MariaDB on Ubuntu 22.04

MariaDB is a popular open-source relational database management system. It is a fork of MySQL and is widely used in web applications. In this section, we will show you how to install MariaDB on Ubuntu 22.04.

Step 1: Update System Packages

Before installing MariaDB, it is recommended to update the system packages to their latest versions. You can do this by running the following command in your terminal:

sudo apt update

Read: How to Install MongoDB on Ubuntu 22.04

Step 2: Install Packages

Next, you need to install the packages required for installing MariaDB. You can do this by running the following command:

sudo apt-get install wget software-properties-common dirmngr ca-certificates apt-transport-https -y

Step 3: Install MariaDB

Once the packages are installed, you can install MariaDB by running the following command:

sudo apt install mariadb-server mariadb-client

This command will start the MariaDB installation process and prompt you to set a root password, remove anonymous users, disallow root login remotely, and remove test databases.

Read: How to Install MySQL Workbench on Ubuntu 22.04

You can answer the prompts according to your preferences.

Read: How To Solve phpMyAdmin Not Working on Ubuntu 22.04

Step 4: Check MariaDB Version

After installing MariaDB, you can check the version of MariaDB by running the following command:

mysql –version

Step 5: Check MariaDB Status

You can check the status of MariaDB by running the following command:

sudo systemctl status mariadb

This command will show you whether MariaDB is running or not.

Read: Quick Guide to Installing PostgreSQL on Ubuntu 22.04

Step 6: Execute MariaDB Script

You can execute the MariaDB script by running the following command:

sudo mysql

This command will open the MariaDB shell, where you can execute SQL commands.

Step 7: Log in to MariaDB

You can log in to MariaDB by running the following command:

sudo mysql -u root -p

This command will prompt you to enter the root password you set during the installation process.

Step 8: Create a Database

You can create a database by running the following command:

CREATE DATABASE net2database;

This command will create a database named “net2database”.

Step 10: View Database

You can view the database by running the following command:

SHOW DATABASES;

This command will show you a list of all the databases on your MariaDB server.

Step 11: Quit MariaDB

Finally, type quit in the terminal to log out from the currently active MariaDB shell.

 


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

Marianne elanotta

Marianne is a graduate in communication technologies and enjoys sharing the latest technological advances across various fields. Her programming skills include Java OO and Javascript, and she prefers working on open-source operating systems. In her free time, she enjoys playing chess and computer games with her two children.

Leave a Reply