Simplest method — gets security updates via normal apt upgrade.
# 1. Update system
sudo apt update
sudo apt upgrade -y
# 2. Install MariaDB server + client
sudo apt install mariadb-server -y
# 3. Check service status
sudo systemctl status mariadb
# Enable on boot (usually already enabled)
sudo systemctl enable mariadb
Use when you need newer features (10.11 is still very reliable for most use cases).
# 1. Install prerequisites
sudo apt update
sudo apt install software-properties-common curl ca-certificates -y
# 2. Add official MariaDB repository
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-11.7"
# Alternative: latest stable series
# curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
# 3. Install
sudo apt update
sudo apt install mariadb-server mariadb-client -y
# 4. Verify version
mariadb --version
sudo mariadb-secure-installation
Recommended answers:
Connect to MariaDB:
# Recommended method (unix_socket)
sudo mariadb
# or with password
mariadb -u root -p
Create your first database + user:
CREATE DATABASE myapp;
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'strong_password123';
GRANT ALL PRIVILEGES ON myapp.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;