How to Install MariaDB 11.8 on Ubuntu (26.04, 24.04, 22.04)

MariaDB 11.8 is the latest long-term support (LTS) release from the MariaDB Foundation, featuring native vector search capabilities for AI workloads, extended TIMESTAMP support until 2106, UTF-8 as the default character set, and faster parallel backup operations. This release delivers LTS stability with modern features ideal for production database deployments.

This guide covers installing MariaDB 11.8 LTS on Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS. Ubuntu 26.04 includes MariaDB 11.8 in its default repositories, while 24.04 and 22.04 users can access it through the official MariaDB repository. By the end, you’ll have a secured MariaDB 11.8 installation ready for production workloads or development environments. For users who prefer their distribution’s default MariaDB version, see our general MariaDB installation guide for Ubuntu.

Default MariaDB Versions by Ubuntu Release

Each Ubuntu LTS release ships with a specific MariaDB version that remains fixed for the distribution’s lifecycle. Understanding what’s available by default helps you decide whether to use your distribution’s packages or add the official MariaDB repository.

Ubuntu ReleaseDefault MariaDBSupport StatusBest For
Ubuntu 26.04 LTSMariaDB 11.8.xLTS until June 2028New deployments needing vector search, AI workloads
Ubuntu 24.04 LTSMariaDB 10.11.xLTS until February 2028Stable production; add MariaDB repo for 11.8
Ubuntu 22.04 LTSMariaDB 10.6.xLTS until July 2026Legacy systems; add MariaDB repo for 11.8

Ubuntu 26.04 users get MariaDB 11.8 directly from the default repositories with automatic security updates from Ubuntu’s security team. Ubuntu 24.04 and 22.04 users who need MariaDB 11.8 features must add the official MariaDB repository, which provides its own update channel.

Choose Your MariaDB 11.8 Installation Method

MariaDB 11.8 LTS can be installed through different channels depending on your Ubuntu version and update preferences. The table below compares available options to help you choose the right approach.

MethodChannelVersionUpdatesBest For
Ubuntu Default (26.04)Ubuntu ReposMariaDB 11.8.xAutomatic via APT upgradesUbuntu 26.04 users who prefer distro-maintained packages
MariaDB RepositoryMariaDB.orgMariaDB 11.8.xAutomatic via APT upgradesUbuntu 24.04/22.04 users who need MariaDB 11.8 features

For Ubuntu 26.04 users, the default repository method is recommended because it provides automatic security updates through Ubuntu’s security team without requiring external repositories. Ubuntu 24.04 and 22.04 users should use the official MariaDB repository to access MariaDB 11.8 LTS features.

This guide covers Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS installations. Ubuntu 26.04 users can install directly from default repositories, while Ubuntu 24.04 and 22.04 users must add the official MariaDB repository first. At the time of writing, the MariaDB.org repository does not yet support Ubuntu 26.04 (resolute). Check the MariaDB download page for updated availability.

Pre-Installation Steps

Update Package Index

Refresh the APT package index before installing new packages to ensure you’re working with current package information and dependencies.

sudo apt update

Apply any pending system updates to avoid version conflicts during the MariaDB installation.

sudo apt upgrade

Option 1: Install MariaDB 11.8 on Ubuntu 26.04 (Default Repos)

Ubuntu 26.04 ships with MariaDB 11.8.x in its default repositories, providing the simplest installation path with automatic security updates managed by Ubuntu’s security team.

Install MariaDB Server and Client

Install both the MariaDB server and command-line client packages.

sudo apt install mariadb-server mariadb-client -y

APT handles all dependencies automatically. The installation initializes the data directory at /var/lib/mysql and creates default configuration files.

Verify Installation

Confirm MariaDB 11.8 installed correctly by checking the version.

mariadb --version

Expected output confirms the 11.8 branch is installed.

mariadb from 11.8.5-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper

Skip to the Secure MariaDB Installation section to continue configuration.

Option 2: Install MariaDB 11.8 via Official Repository (Ubuntu 24.04/22.04)

Ubuntu 24.04 ships MariaDB 10.11.x and Ubuntu 22.04 ships MariaDB 10.6.x by default. To access MariaDB 11.8 LTS features on these releases, add the official MariaDB repository maintained by the MariaDB Foundation.

Install Required Packages

Install the prerequisites needed to add and verify the MariaDB repository.

sudo apt install curl ca-certificates -y

Import MariaDB GPG Key

Download the MariaDB release signing key and store it in the system keyring directory. This key verifies package authenticity during installation.

sudo mkdir -p /etc/apt/keyrings
sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'

Add MariaDB Repository

Create a repository configuration file using the DEB822 format. The $(lsb_release -cs) variable automatically inserts your Ubuntu codename (noble for 24.04, jammy for 22.04).

cat <<EOF | sudo tee /etc/apt/sources.list.d/mariadb.sources
X-Repolib-Name: MariaDB
Types: deb
URIs: https://deb.mariadb.org/11.8/ubuntu
Suites: $(lsb_release -cs)
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
EOF

The configuration above uses deb.mariadb.org, a dynamic mirror service that automatically selects a nearby server. If you prefer a specific regional mirror for faster downloads, visit the MariaDB Mirrorbits page and replace the URIs line with your preferred mirror (e.g., URIs: https://mirror.aarnet.edu.au/pub/MariaDB/repo/11.8/ubuntu for Australia).

Update Package Index and Install MariaDB

Refresh the package index to include the new MariaDB repository, then install MariaDB 11.8.

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

Verify Installation

Confirm MariaDB 11.8 installed from the MariaDB repository.

mariadb --version

Expected output shows the 11.8 version.

mariadb from 11.8.5-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper

Secure MariaDB Installation

Start and Enable MariaDB Service

MariaDB may not start automatically after installation. Start the service and enable it to launch on system boot.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Verify the service is running.

sudo systemctl status mariadb --no-pager

Expected output shows the service active and running.

● mariadb.service - MariaDB 11.8.5 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled)
     Active: active (running) since Mon 2026-01-27 10:30:45 UTC; 1min ago
   Main PID: 12345 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 14 (limit: 4915)
     Memory: 120.5M
        CPU: 1.234s
     CGroup: /system.slice/mariadb.service
             └─12345 /usr/sbin/mariadbd

Run the Security Configuration Script

MariaDB ships with development-friendly defaults that aren’t suitable for production. The mariadb-secure-installation script removes test databases, disables remote root login, and applies production-grade security settings.

sudo mariadb-secure-installation

Interactive Prompts and Responses

The script guides you through several security decisions. Understanding each prompt helps you make informed choices for your environment.

The security script runs interactively, pausing at each prompt for your response. Type Y and press Enter to accept the recommended security option, or n to skip. For production environments, accept all recommendations by answering Y to every prompt.

Current Root Password

Enter current password for root (enter for none): [Press ENTER]

Fresh MariaDB installations have no root password set. Press Enter to proceed with securing the installation.

Unix Socket Authentication (unix_socket)

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

Unix socket authentication ties MariaDB root access to your Linux system account. After enabling this, you connect to MariaDB as root by running sudo mariadb without typing a database password. The database verifies you’re the system administrator through Linux’s authentication system rather than checking a stored password. This eliminates weak password risks while keeping administrative access straightforward.

Root Password

Change the root password? [Y/n] Y
New password: [Enter your password]
Re-enter new password: [Confirm your password]
Password updated successfully!
Reloading privilege tables..
 ... Success!

Setting a root password creates a backup authentication method even with unix_socket enabled. You’ll need this password if you disable unix_socket later, connect using database management tools that don’t support socket authentication, or need to troubleshoot authentication issues.

Anonymous Users

Remove anonymous users? [Y/n] Y
 ... Success!

This deletes test accounts with blank usernames that allow anyone to connect without authentication. On servers handling real data, anonymous accounts create an open door for unauthorized access.

Remote Root Login

Disallow root login remotely? [Y/n] Y
 ... Success!

Restricts root account connections to localhost only. The root account has unlimited database privileges, making it a prime target for attackers. After this change, root access requires console or SSH access to the server itself.

Test Database

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Deletes the default test database that grants read-write access to all users regardless of authentication. Attackers can abuse this open access to store malicious payloads or probe for privilege escalation paths.

Reload Privilege Tables

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

This applies all security changes immediately without requiring a database restart. Your MariaDB 11.8 installation is now secured with production-grade defaults.

Basic MariaDB Administration

Service Management Commands

Control the MariaDB service using systemd commands.

Stop the database server (terminates all connections).

sudo systemctl stop mariadb

Restart the server (required after configuration file changes).

sudo systemctl restart mariadb

Reload configuration without disconnecting clients.

sudo systemctl reload mariadb

Disable automatic startup on boot.

sudo systemctl disable mariadb

Connect to MariaDB

Access the MariaDB command-line client. With unix_socket authentication enabled, the system root user connects without a password.

sudo mariadb

Execute SQL commands to create databases, manage users, and query data. Type EXIT; or press Ctrl+D to close the connection.

Configure Firewall for MariaDB

MariaDB binds to localhost (127.0.0.1) by default, preventing network connections from other machines. This is the recommended secure configuration when the application and database run on the same server. No firewall changes are needed for localhost-only access.

Verify MariaDB listens only on localhost.

sudo grep -E '^bind-address' /etc/mysql/mariadb.conf.d/50-server.cnf

Expected output shows the localhost binding.

bind-address = 127.0.0.1

If you need to allow remote database connections (such as for separate application and database servers), edit the bind-address setting, configure UFW to allow connections from specific IP addresses only, and create dedicated database users with limited privileges. See our UFW firewall guide for Ubuntu for detailed instructions.

Next Steps for Web Applications

For web application deployments, MariaDB 11.8 integrates with popular server stacks. Install Nginx on Ubuntu or Apache on Ubuntu as your web server, then add PHP on Ubuntu to complete your LEMP or LAMP stack. For web-based database management, consider installing phpMyAdmin for Ubuntu with Nginx.

Basic Database Operations

These SQL commands cover the most common database management tasks. Run them from the MariaDB prompt after connecting with sudo mariadb.

Create a database:

CREATE DATABASE myapp;

List all databases:

SHOW DATABASES;

Switch to a database:

USE myapp;

View current database:

SELECT DATABASE();

Create a Database User

Applications should connect to MariaDB using dedicated user accounts with limited privileges rather than the root account. This limits damage if application credentials are compromised and makes it easier to audit database access.

Create a user that can only connect from localhost (the same server):

CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password_here';

Grant the user full privileges on a specific database only:

GRANT ALL PRIVILEGES ON myapp.* TO 'myapp_user'@'localhost';

Apply the privilege changes immediately:

FLUSH PRIVILEGES;

Verify the user was created and has the correct privileges:

SHOW GRANTS FOR 'myapp_user'@'localhost';

Expected output confirms the granted privileges:

+----------------------------------------------------------------------+
| Grants for myapp_user@localhost                                      |
+----------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `myapp_user`@`localhost` IDENTIFIED BY ...     |
| GRANT ALL PRIVILEGES ON `myapp`.* TO `myapp_user`@`localhost`        |
+----------------------------------------------------------------------+

Test the new user account by connecting with it:

mariadb -u myapp_user -p myapp

Enter the password when prompted. A successful connection confirms the user account works correctly.

MariaDB 11.8 New Features

MariaDB 11.8 LTS introduces several significant improvements over the previous LTS release (11.4). Understanding these features helps you leverage the full capabilities of this release.

Vector Search (MariaDB Vector)

MariaDB 11.8 includes native vector search capabilities essential for AI and machine learning applications. Vector search lets you find similar items based on meaning rather than exact text matches. This approach is useful for recommendation systems, semantic search, and retrieval-augmented generation (RAG) applications.

The new VECTOR data type stores embeddings generated by AI models (OpenAI, LLaMA, sentence-transformers, etc.). A specialized VECTOR INDEX enables fast approximate nearest-neighbor searches using the HNSW algorithm.

CREATE TABLE products (
    id INT PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(255),
    description TEXT,
    embedding VECTOR(384) NOT NULL,
    VECTOR INDEX (embedding) DISTANCE=cosine
) ENGINE=InnoDB;

The VECTOR(384) dimension must match your embedding model’s output size. Common dimensions include 384 (sentence-transformers), 1536 (OpenAI ada-002), and 3072 (OpenAI text-embedding-3-large).

Insert vectors using VEC_FromText() to convert JSON arrays:

INSERT INTO products (name, description, embedding) VALUES
('Espresso Machine', 'Professional barista-grade espresso maker with built-in grinder',
 VEC_FromText('[0.12, -0.34, 0.56, ...]'));

Search for similar items by ordering by vector distance with a LIMIT clause. The optimizer automatically uses the vector index:

SELECT name, description
FROM products
ORDER BY VEC_DISTANCE_COSINE(embedding, VEC_FromText('[0.15, -0.32, 0.51, ...]'))
LIMIT 10;

MariaDB includes SIMD optimizations for Intel AVX2/AVX512, ARM NEON, and IBM Power10 processors, delivering performance competitive with dedicated vector databases while keeping your data in a familiar relational system.

Extended TIMESTAMP Range

MariaDB 11.8 extends TIMESTAMP support from 2038 to 2106, addressing the Year 2038 problem without requiring data conversion for most tables. Applications with long-term date storage requirements benefit from this 80-year extension.

UTF-8 Default Character Set

New databases default to utf8mb4 character set with full Unicode support including emoji. This change aligns MariaDB with modern global application requirements without manual character set configuration.

Parallel Backup and Restore

mariadb-dump and mariadb-import now support parallel operations using the --dir option, significantly reducing backup and restore times for large databases. Instead of writing a single SQL file, parallel mode creates a directory structure with separate files per table that can be processed concurrently.

Create a parallel backup of multiple databases:

mariadb-dump --dir=/backup/mariadb --databases myapp analytics

Restore using parallel import with automatic thread scaling:

mariadb-import --dir=/backup/mariadb

The --innodb-optimize-keys option (enabled by default in 11.8) delays secondary index creation until after data load, further accelerating large restores.

Troubleshooting

Cannot Connect to MariaDB Server

Error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

This error means the MariaDB service isn’t running or the socket file doesn’t exist. Check the service status first:

sudo systemctl status mariadb

If the service shows as inactive or failed, start it:

sudo systemctl start mariadb

If the service fails to start, check the journal for specific error messages:

sudo journalctl -xeu mariadb.service

Common causes include insufficient disk space in /var/lib/mysql, permission issues on the data directory, or corrupted InnoDB tablespace files. The journal output will indicate the specific problem.

Access Denied for Root User

Error: ERROR 1698 (28000): Access denied for user 'root'@'localhost'

This error occurs when trying to connect as root without sudo. MariaDB on Ubuntu uses unix socket authentication by default for the root user, which ties database root access to the Linux root account.

Connect using sudo to authenticate via the socket:

sudo mariadb

To verify that unix socket authentication is active:

SELECT user, host, plugin FROM mysql.user WHERE user='root';

Expected output shows the unix_socket plugin:

+------+-----------+-------------+
| user | host      | plugin      |
+------+-----------+-------------+
| root | localhost | unix_socket |
+------+-----------+-------------+

If you need password-based root authentication (for example, to connect from database management tools that don’t support socket auth), you can switch the authentication method:

ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('your_secure_password');
FLUSH PRIVILEGES;

Repository Key or Package Errors (Ubuntu 24.04/22.04)

Error: GPG key verification failures, “NO_PUBKEY” messages, or missing packages after adding the MariaDB repository.

First, verify the GPG key file exists and has content:

ls -la /etc/apt/keyrings/mariadb-keyring.pgp

The file should be approximately 3.6KB. If it’s empty or missing, re-download the key:

sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'

Check that the repository configuration matches your Ubuntu version:

cat /etc/apt/sources.list.d/mariadb.sources

Verify the Suites: line shows your correct Ubuntu codename (noble for 24.04, jammy for 22.04). If it shows the wrong codename, recreate the sources file using the repository configuration command from earlier in this guide.

Service Fails After Upgrade

Symptom: MariaDB won’t start after upgrading from an older version, with errors about incompatible data files.

Major version upgrades sometimes require running the upgrade script to update system tables:

sudo mariadb-upgrade

If the service won’t start at all, try starting in safe mode to diagnose the issue:

sudo mariadbd-safe --skip-grant-tables &

Once running, connect with sudo mariadb and check for corrupted tables or other issues. Stop the safe-mode server with sudo killall mariadbd when done diagnosing.

Remove MariaDB 11.8

If you need to remove MariaDB from your system, you have two options depending on whether you want to preserve your databases for a future reinstall.

Remove Packages Only (Preserve Data)

This removes MariaDB packages but keeps your databases and configuration files intact:

sudo systemctl stop mariadb
sudo apt remove mariadb-server mariadb-client
sudo apt autoremove

Your databases remain in /var/lib/mysql and configuration in /etc/mysql. Reinstalling MariaDB later will restore access to existing databases.

Complete Removal (Delete Everything)

The following commands permanently delete all MariaDB databases and configuration. Back up any data you need before proceeding. This action cannot be undone.

Stop the service and purge all packages including configuration files:

sudo systemctl stop mariadb
sudo apt purge mariadb-server mariadb-client mariadb-common
sudo apt autoremove --purge

Remove the data directory and any remaining configuration:

sudo rm -rf /var/lib/mysql /etc/mysql

Remove the MariaDB system user (optional, only if you won’t reinstall):

sudo deluser --remove-home mysql

Remove MariaDB Repository (Ubuntu 24.04/22.04)

If you added the MariaDB repository, remove the configuration file and GPG key:

sudo rm /etc/apt/sources.list.d/mariadb.sources
sudo rm /etc/apt/keyrings/mariadb-keyring.pgp
sudo apt update

Frequently Asked Questions

What is the difference between MariaDB 11.8 and the Ubuntu default versions?

MariaDB 11.8 LTS introduces vector search for AI workloads, extends TIMESTAMP range to 2106, defaults to UTF-8, and adds parallel backup/restore. Ubuntu 24.04 ships 10.11 and Ubuntu 22.04 ships 10.6, both stable but lacking these features. The previous MariaDB LTS is 11.4 (supported until May 2029), while 11.8 is supported until June 2028.

Should I upgrade from Ubuntu’s default MariaDB to 11.8?

Upgrade to 11.8 if you need vector search for AI applications, require TIMESTAMP dates beyond 2038, or want the new parallel backup features. Stay with your Ubuntu default (10.11 on 24.04, 10.6 on 22.04) if your current setup works well and you don’t need these features. Ubuntu’s defaults receive security updates through their respective EOL dates.

Is MariaDB 11.8 compatible with MySQL applications?

Yes. MariaDB 11.8 maintains protocol-level compatibility with MySQL and works as a drop-in replacement for most applications. The same client libraries, connection strings, and SQL syntax apply. Some MySQL-specific features may differ, but standard application code works without changes.

Why does Ubuntu 26.04 include MariaDB 11.8 but 24.04 has 10.11?

Ubuntu freezes package versions when each release ships and maintains them throughout the support period. Ubuntu 26.04 shipped after MariaDB 11.8 reached LTS status, while 24.04 shipped with 10.11 as the current LTS. Ubuntu backports security fixes but does not introduce new major versions to existing releases.

Why can’t I connect to MariaDB without sudo?

MariaDB on Ubuntu uses unix socket authentication for the root user by default. This ties database root access to your Linux system account rather than a separate password. Use sudo mariadb to connect as root, or create a dedicated database user with password authentication for your applications.

Conclusion

You now have MariaDB 11.8 LTS installed and secured on Ubuntu. Whether you used Ubuntu 26.04’s default repositories or added the official MariaDB repository on 24.04/22.04, your database server is ready for production workloads. MariaDB 11.8 brings meaningful improvements including native vector search for AI applications, extended timestamp support, and faster backup operations. These features make this LTS release well-suited for modern database requirements.

Useful Links

Leave a Comment

Let us know you are human: