✨ Install MariaDB 11 on Ubuntu 22.04 ✨

1️⃣ Update System Packages

Open your terminal and run the following commands to update your system:

sudo apt update
sudo apt upgrade -y

2️⃣ Add the MariaDB APT Repository

Import the GPG key and add the MariaDB repository:

sudo apt install -y software-properties-common dirmngr apt-transport-https ca-certificates
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://mariadb.org/mariadb_release_signing_key.asc | sudo tee /etc/apt/keyrings/mariadb.gpg > /dev/null

Add the repository to your system:

echo "deb [signed-by=/etc/apt/keyrings/mariadb.gpg] https://mirrors.xtom.com/mariadb/repo/11.0/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/mariadb.list

3️⃣ Install MariaDB 11

Update your package list and install MariaDB:

sudo apt update
sudo apt install mariadb-server mariadb-client -y

4️⃣ Verify Installation

Check if MariaDB is running:

sudo systemctl status mariadb

If needed, start and enable MariaDB:

sudo systemctl start mariadb
sudo systemctl enable mariadb

5️⃣ Secure MariaDB Installation

Run the security script to configure MariaDB:

sudo mysql_secure_installation

Follow the prompts to set a root password and secure the installation.

6️⃣ Test MariaDB

Log in and verify the installation:

sudo mariadb -u root -p
SELECT VERSION();
EXIT;

7️⃣ Optional: Enable Remote Access

To allow remote connections, edit the configuration file:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Change bind-address to:

bind-address = 0.0.0.0

Restart MariaDB:

sudo systemctl restart mariadb

8️⃣ Backup and Restore MariaDB

Backup Process

To back up a MariaDB database, use the mysqldump command:

mysqldump -u [username] -p [database_name] > [backup_file.sql]

Example:

mysqldump -u root -p my_database > my_database_backup.sql

This will create a backup file named my_database_backup.sql in the current directory.

Restore Process

To restore a database from a backup, use the following command:

mysql -u [username] -p [database_name] < [backup_file.sql]

Example:

mysql -u root -p my_database < my_database_backup.sql

Ensure the database my_database exists before restoring, or create it with:

mysql -u root -p -e "CREATE DATABASE my_database;"
⚠️ Note: Be cautious when enabling remote access. Ensure you secure your server with proper firewall rules.

 

 

Related articles

Install and Run a Kubernetes Cluster

Install and Run a Kubernetes Cluster Kubernetes, widely known as K8s, is the de facto standard for container orchestration....

How to Install GIT Hooks

How to Install GIT Hooks Git hooks are powerful automation tools that allow developers to execute custom scripts at...

Cloud Resource Monitoring

Cloud Resource Monitoring Cloud resource monitoring and optimization are essential for ensuring the efficient use of infrastructure, controlling costs,...

Continuous Integration With Git and Jenkins

Continuous Integration with Git and Jenkins Introduction Continuous Integration (CI) is a crucial practice in modern software development, allowing teams...