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.
Ensure you have root or sudo privileges. Before installation, update the package repository:
sudo dnf update -y
Installing MariaDB from Package Manager
Run the MariaDB repository setup script:
chmod +x 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.
Use the package manager to install MariaDB:
sudo dnf install mariadb-server -y
This command installs the MariaDB server along with necessary dependencies.
Start and enable MariaDB
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure MariaDB Server installation
This script prompts you to set the root password, remove anonymous users, restrict root login to local, and more.
Log in to MariaDB with the root user:
sudo mariadb -u root -p
Enter the root password when prompted.
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';
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.
After making changes, restart the MariaDB service:
sudo systemctl restart mariadb
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!