How to Install MariaDB on Ubuntu 24.04 LTS

In this article, We are going to cover How to Install MariaDB on Ubuntu 24.04 LTS, Secure the MariaDB Server on Ubuntu 24.04 LTS and Access MariaDB on Ubuntu 24.04 LTS.

MariaDB is a popular, open-source database system, widely used for its reliability and performance. It’s a fork of MySQL, designed to remain fully open-source. Ubuntu 24.04, with its stability and flexibility, is a great platform for running MariaDB. In this guide, we’ll walk you through the simple steps to install and configure MariaDB on Ubuntu 24.04, ensuring your system is ready to handle database tasks efficiently.

Prerequisites

  • SSH Access with admin privileges
  • Ubuntu 24.04 LTS with minimal installation

Install MariaDB on Ubuntu 24.04 LTS

Update ubuntu

sudo apt update

Install MariaDB

sudo apt install mariadb-server

Check MariaDB version

mariadb --version
How to Install MariaDB on Ubuntu 24.04 LTS 1

Enable the MariaDB system service to start at boot time.

sudo systemctl enable mariadb

Start MariaDB

sudo systemctl start mariadb

View the status of MariaDB

sudo systemctl status mariadb
How to Install MariaDB on Ubuntu 24.04 LTS 2

Secure the MariaDB Server on Ubuntu 24.04 LTS

Run the MariaDB security script

sudo mysql_secure_installation
How to Install MariaDB on Ubuntu 24.04 LTS 3

click on ‘N’

How to Install MariaDB on Ubuntu 24.04 LTS 4

click on ‘y’

How to Install MariaDB on Ubuntu 24.04 LTS 5

Click on ‘y’

How to Install MariaDB on Ubuntu 24.04 LTS 6

Give the new password

How to Install MariaDB on Ubuntu 24.04 LTS 7

Re-enter the password

How to Install MariaDB on Ubuntu 24.04 LTS 8

Click on ‘y’

How to Install MariaDB on Ubuntu 24.04 LTS 9

Click on ‘y’

How to Install MariaDB on Ubuntu 24.04 LTS 10

Click on ‘y’

How to Install MariaDB on Ubuntu 24.04 LTS 11

Click on ‘y’

How to Install MariaDB on Ubuntu 24.04 LTS 12

Access MariaDB on Ubuntu 24.04 LTS

Log in to the MariaDB database server:

sudo mariadb -u root -p
How to Install MariaDB on Ubuntu 24.04 LTS 13

Log in and eneter the password

How to Install MariaDB on Ubuntu 24.04 LTS 14

To create a new database and a new user, use the following commands inside the MariaDB shell:

Create a new Database:

CREATE DATABASE mydatabase;
How to Install MariaDB on Ubuntu 24.04 LTS 15

Create a new user with a strong password:

CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'harish';
How to Install MariaDB on Ubuntu 24.04 LTS 16

Grant privileges to the new user on the new database:

GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
How to Install MariaDB on Ubuntu 24.04 LTS 17

Use the below command to apply the changes:

FLUSH PRIVILEGES;

View all databases on the server by using the below command:

SHOW DATABASES;
How to Install MariaDB on Ubuntu 24.04 LTS 18

To exit the MariaDB shell, just type:

exit
How to Install MariaDB on Ubuntu 24.04 LTS 19

Conclusion:

By following the steps outlined in this guide, you’ve successfully installed, secured, and accessed MariaDB on your Ubuntu 24.04 system. With MariaDB set up and security configurations in place, you’re now ready to manage databases efficiently and securely. Whether you’re building web applications, managing large-scale data, or exploring database development, MariaDB provides the stability and flexibility needed to handle a wide range of use cases. Keep your system updated, regularly back up your databases, and you’ll have a solid foundation for your database needs.

Related Articles:

How to Install MariaDB on Ubuntu 20.04 LTS

Reference:

MariaDB official Documentation

Harish Reddy

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap