Installing and Configuring MariaDB on AlmaLinux

Unlock the power of MariaDB on AlmaLinux! Follow our simple guide to install, configure, and secure MariaDB

Installing and Configuring MariaDB on AlmaLinux

MariaDB, a robust open-source relational database management system, is a key component for many applications. In this advanced guide, we'll walk you through the installation and configuration of MariaDB on your AlmaLinux system.


Prerequisites:


Ensure you have root or sudo privileges. Before installation, update the package repository:

sudo dnf update -y
Update the package repository


Installing MariaDB from Package Manager

Run the MariaDB repository setup script:

wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
sudo ./mariadb_repo_setup

Execute the MariaDB repository setup script to integrate the latest stable release into your system's repositories. This script ensures that your package manager is aware of the up-to-date MariaDB version, allowing you to install it seamlessly.

Downloading and giving the executing permission to MariaDB Script
Executing MariaDB Script

Use the package manager to install MariaDB:

sudo dnf install mariadb-server -y

This command installs the MariaDB server along with necessary dependencies.

Install MariaDB server on AlmaLinux
Install MariaDB server on AlmaLinux

Start and enable MariaDB

sudo systemctl start mariadb
sudo systemctl enable mariadb
Start and Enable MariaDB service


Secure MariaDB Server installation

sudo mysql_secure_installation

This script prompts you to set the root password, remove anonymous users, restrict root login to local, and more.


Accessing MariaDB

Log in to MariaDB with the root user:

sudo mariadb -u root -p

Enter the root password when prompted.

Connecting to MariaDB


Creating a Database and User

Create a new database and user with appropriate privileges:

CREATE DATABASE krython_database;
CREATE USER 'krython_user'@'localhost' IDENTIFIED BY 'krython_password';
GRANT ALL PRIVILEGES ON krython_database.* TO 'krython_user'@'localhost';
FLUSH PRIVILEGES;

Replace krython_database, krython_user, and krython_password with your desired values.


Adjusting MariaDB Configuration

Edit the MariaDB configuration file to optimize performance:

sudo nano /etc/my.cnf.d/server.cnf

Add or modify parameters such as innodb_buffer_pool_size based on your system requirements.


Restarting MariaDB

After making changes, restart the MariaDB service:

sudo systemctl restart mariadb


Conclusion

Congratulations! You've successfully installed and configured MariaDB on AlmaLinux. This powerful database is now ready to support your applications. If you encounter any issues or have questions, feel free to leave a comment below. Happy databasing!


Enjoying our content? Your support keeps us going! 🚀

Consider buying us a coffee to help fuel our creativity.