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.
Table of Contents
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
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
Secure the MariaDB Server on Ubuntu 24.04 LTS
Run the MariaDB security script
sudo mysql_secure_installation
click on ‘N’
click on ‘y’
Click on ‘y’
Give the new password
Re-enter the password
Click on ‘y’
Click on ‘y’
Click on ‘y’
Click on ‘y’
Access MariaDB on Ubuntu 24.04 LTS
Log in to the MariaDB database server:
sudo mariadb -u root -p
Log in and eneter the password
To create a new database and a new user, use the following commands inside the MariaDB shell:
Create a new Database:
CREATE DATABASE mydatabase;
Create a new user with a strong password:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'harish';
Grant privileges to the new user on the new database:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
Use the below command to apply the changes:
FLUSH PRIVILEGES;
View all databases on the server by using the below command:
SHOW DATABASES;
To exit the MariaDB shell, just type:
exit
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: