Tools: Installing MariaDB on Ubuntu 26.04 - Full Analysis

Tools: Installing MariaDB on Ubuntu 26.04 - Full Analysis

Install MariaDB

Manage the MariaDB Service

Secure MariaDB

Create a Database and User

Create a Sample Table

Next Steps MariaDB is a drop-in replacement for MySQL that remains fully open source under the GPL license, available directly from Ubuntu 26.04's default APT repository with no external sources required. This guide covers installation, service configuration, security hardening with mariadb-secure-installation, and basic database operations to confirm a working setup. MariaDB is available directly in Ubuntu 26.04's default APT repository. 1. Update the APT package index: 2. Install the MariaDB server package: 3. Verify the installed version: Enable MariaDB as a systemd service so it starts automatically on every boot. 1. Enable and start the service: 2. Check the service status: 3. Stop or restart the service when needed: The mariadb-secure-installation script removes default configuration risks including anonymous users, remote root login, and the test database. Restart MariaDB to apply the changes: Log in as root and create a dedicated database with a user scoped to that database only. Log in as the new user to verify database access and permissions. All three rows in the query output confirm the database, user, and table are working correctly. MariaDB is now installed and accepting connections. From here you can: For the full guide with additional tips, visit the original article on Vultr Docs. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install mariadb-server -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install mariadb-server -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install mariadb-server -y $ mariadb --version $ mariadb --version $ mariadb --version $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">stop mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart mariadb $ -weight: 600;">sudo mariadb-secure-installation $ -weight: 600;">sudo mariadb-secure-installation $ -weight: 600;">sudo mariadb-secure-installation $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart mariadb $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart mariadb $ -weight: 600;">sudo mariadb -u root -p $ -weight: 600;">sudo mariadb -u root -p $ -weight: 600;">sudo mariadb -u root -p MariaDB [(none)]> CREATE DATABASE myapp_db; MariaDB [(none)]> CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON myapp_db.* TO 'myapp_user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT; MariaDB [(none)]> CREATE DATABASE myapp_db; MariaDB [(none)]> CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON myapp_db.* TO 'myapp_user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT; MariaDB [(none)]> CREATE DATABASE myapp_db; MariaDB [(none)]> CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON myapp_db.* TO 'myapp_user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT; $ mariadb -u myapp_user -p myapp_db $ mariadb -u myapp_user -p myapp_db $ mariadb -u myapp_user -p myapp_db MariaDB [myapp_db]> CREATE TABLE employees ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, role VARCHAR(100), department VARCHAR(100) ); MariaDB [myapp_db]> MariaDB [myapp_db]> INSERT INTO employees (name, role, department) VALUES ('Alice', 'Engineer', 'Backend'), ('Bob', 'Designer', 'Frontend'), ('Carol', 'DevOps', 'Infrastructure'); MariaDB [myapp_db]> SELECT * FROM employees; MariaDB [myapp_db]> EXIT; MariaDB [myapp_db]> CREATE TABLE employees ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, role VARCHAR(100), department VARCHAR(100) ); MariaDB [myapp_db]> MariaDB [myapp_db]> INSERT INTO employees (name, role, department) VALUES ('Alice', 'Engineer', 'Backend'), ('Bob', 'Designer', 'Frontend'), ('Carol', 'DevOps', 'Infrastructure'); MariaDB [myapp_db]> SELECT * FROM employees; MariaDB [myapp_db]> EXIT; MariaDB [myapp_db]> CREATE TABLE employees ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, role VARCHAR(100), department VARCHAR(100) ); MariaDB [myapp_db]> MariaDB [myapp_db]> INSERT INTO employees (name, role, department) VALUES ('Alice', 'Engineer', 'Backend'), ('Bob', 'Designer', 'Frontend'), ('Carol', 'DevOps', 'Infrastructure'); MariaDB [myapp_db]> SELECT * FROM employees; MariaDB [myapp_db]> EXIT; - Use MariaDB as the database layer in a LAMP or LEMP stack - Set up Galera Cluster for multi-master replication - Automate backups with mariadb-dump