MariaDB 11.8 is the branch to install on Ubuntu when you need the newer LTS feature set, including native vector search, the extended TIMESTAMP range through 2106, and parallel logical backup support. Ubuntu 26.04 LTS ships MariaDB 11.8 in the default repositories, while Ubuntu 24.04 LTS and Ubuntu 22.04 LTS need the official MariaDB.org APT repository to install the same 11.8 series.
This version-specific page is for MariaDB 11.8. If you want the database branch maintained in your Ubuntu release without adding an external repository, use the general MariaDB installation guide for Ubuntu instead. MariaDB 11.8 remains MySQL-protocol compatible for most applications, but major database upgrades still deserve a backup and application test before production rollout.
Install MariaDB 11.8 on Ubuntu
Choose the install path that matches your Ubuntu release. The MariaDB.org repository currently publishes packages for noble and jammy, but not resolute, so Ubuntu 26.04 should use Ubuntu’s own package unless MariaDB adds native 26.04 repository metadata later.
| Ubuntu release | Default MariaDB candidate | MariaDB 11.8 path | Use this when |
|---|---|---|---|
| Ubuntu 26.04 LTS (resolute) | 11.8.x from Ubuntu main | Default Ubuntu repository | You want 11.8 with normal Ubuntu APT updates and no external source. |
| Ubuntu 24.04 LTS (noble) | 10.11.x from Ubuntu universe updates | MariaDB.org 11.8 repository | You need 11.8 features instead of the maintained 10.11 branch. |
| Ubuntu 22.04 LTS (jammy) | 10.6.x from Ubuntu universe updates | MariaDB.org 11.8 repository | You need 11.8 on an older LTS release and have planned the major-version upgrade. |
Use only one MariaDB package source for the 11.8 branch. Do not point Ubuntu 26.04 at the older
nobleorjammyrepository as a shortcut, and do not keep duplicate MariaDB source files with different keyring paths. APT can reject duplicate repositories or upgrade from an unintended source.
Update Ubuntu Packages
Refresh package metadata before installing or changing repository sources.
sudo apt update
These commands use
sudofor package installation and service management. If your account does not have administrator access yet, add it with the guide on how to add a new user to sudoers on Ubuntu before continuing.
Apply pending package upgrades before installing MariaDB, especially on long-running servers.
sudo apt upgrade
Method 1: Install MariaDB 11.8 from Ubuntu Repositories on 26.04
Ubuntu 26.04 includes MariaDB 11.8 in the default main repository, so no MariaDB.org source file is needed on this release.
Install the Server and Client Packages
Install the database server and the command-line client in one APT transaction.
sudo apt install mariadb-server mariadb-client -y
Ubuntu 26.04 initializes MariaDB under /var/lib/mariadb/, not /var/lib/mysql/. Keep that path difference in mind when backing up or removing a 26.04 installation.
Verify the Ubuntu Package Source
Check that APT selected the Ubuntu 26.04 package from the resolute archive.
apt-cache policy mariadb-server
Relevant output includes the 11.8 package from Ubuntu’s repository.
mariadb-server:
Installed: 1:11.8.6-5
Candidate: 1:11.8.6-5
Version table:
*** 1:11.8.6-5 500
500 http://au.archive.ubuntu.com/ubuntu resolute/main amd64 Packages
100 /var/lib/dpkg/status
Confirm the installed client reports the 11.8 branch. Future 11.8 patch releases may show a newer 11.8.x value.
mariadb --version
mariadb from 11.8.6-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper
Method 2: Install MariaDB 11.8 from MariaDB.org on 24.04 and 22.04
Ubuntu 24.04 and 22.04 ship older MariaDB LTS branches, so the MariaDB.org repository is the supported APT path when those releases need MariaDB 11.8. This keeps installs and updates under APT instead of using manual archive downloads from the MariaDB download page.
Back up existing databases before upgrading from MariaDB 10.11 or 10.6 to 11.8. The package upgrade path works, but a major database version change can expose application compatibility issues that a clean install will not show.
Install Required Packages
Install curl for the key download, ca-certificates for HTTPS certificate validation, and gnupg for the gpg --dearmor conversion. The curl command guide explains common download flags if you want more context.
sudo apt install curl ca-certificates gnupg -y
Import the MariaDB Signing Key
MariaDB publishes an ASCII-armored signing key. Use this pipeline to store a dearmored keyring under /etc/apt/keyrings/ and overwrite the same file cleanly on reruns.
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://mariadb.org/mariadb_release_signing_key.pgp | sudo gpg --dearmor --yes -o /etc/apt/keyrings/mariadb-keyring.gpg
Add the MariaDB 11.8 DEB822 Source
Create a DEB822 source file for the current Ubuntu codename. The command reads VERSION_CODENAME from /etc/os-release, so Ubuntu 24.04 writes noble and Ubuntu 22.04 writes jammy.
printf '%s\n' \
'X-Repolib-Name: MariaDB' \
'Types: deb' \
'URIs: https://deb.mariadb.org/11.8/ubuntu' \
"Suites: $(. /etc/os-release; printf '%s' "$VERSION_CODENAME")" \
'Components: main' \
'Signed-By: /etc/apt/keyrings/mariadb-keyring.gpg' \
| sudo tee /etc/apt/sources.list.d/mariadb.sources > /dev/null
The tee command writes the file with root privileges. Plain shell redirection would run as your normal user and fail against /etc/apt/sources.list.d/.
Verify the MariaDB Repository
Refresh APT metadata and confirm the MariaDB.org repository wins for mariadb-server.
sudo apt update
apt-cache policy mariadb-server
Ubuntu 24.04 should show the ubu2404 build from noble.
mariadb-server:
Installed: (none)
Candidate: 1:11.8.6+maria~ubu2404
Version table:
1:11.8.6+maria~ubu2404 500
500 https://deb.mariadb.org/11.8/ubuntu noble/main amd64 Packages
Ubuntu 22.04 should show the ubu2204 build from jammy. If MariaDB 10.6 is already installed, the Installed line will show the existing Ubuntu package until you upgrade.
mariadb-server:
Installed: 1:10.6.23-0ubuntu0.22.04.1
Candidate: 1:11.8.6+maria~ubu2204
Version table:
1:11.8.6+maria~ubu2204 500
500 https://deb.mariadb.org/11.8/ubuntu jammy/main amd64 Packages
Install MariaDB 11.8 Packages
Install the server and client packages from the MariaDB.org repository.
sudo apt install mariadb-server mariadb-client -y
On Ubuntu 24.04 and 22.04, MariaDB uses /var/lib/mysql/ as the data directory. That differs from Ubuntu 26.04’s /var/lib/mariadb/ path.
Verify MariaDB 11.8
Check the installed client version after the package transaction completes.
mariadb --version
mariadb from 11.8.6-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper
Install the MariaDB Client Only
If you only need to connect to a remote MariaDB server, install the client package without the local server. On Ubuntu 24.04 or 22.04, add the MariaDB.org repository first when the client must match the 11.8 series.
sudo apt install mariadb-client -y
Then connect to your remote server with its hostname, username, and database name.
mariadb -h db.example.com -u myapp_user -p myapp
Secure MariaDB 11.8
Check the MariaDB Service
The package normally starts and enables mariadb.service during installation. Verify that state before running security or administration commands.
systemctl status mariadb --no-pager
Relevant output includes an active service.
mariadb.service - MariaDB 11.8.6 database server
Loaded: loaded
Active: active (running)
If the service is inactive, start it and enable startup at boot.
sudo systemctl enable --now mariadb
Run the Security Script
MariaDB ships with an interactive hardening script that removes anonymous users, disables remote root login, and removes the default test database. The command name uses hyphens, not underscores.
sudo mariadb-secure-installation
Fresh Ubuntu installs allow administrative access through sudo mariadb. Press Enter at the current password prompt, then answer the remaining prompts according to your environment. For production systems, accept the hardening prompts unless you have a specific reason to keep the default test objects.
Enter current password for root (enter for none): [Press Enter] Switch to unix_socket authentication [Y/n] Y Change the root password? [Y/n] Y Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Use sudo mariadb for local administrative sessions after socket authentication is enabled. Create separate database users for applications instead of using the root account from web apps or scripts.
Manage MariaDB 11.8
Connect as the Database Root User
Open the MariaDB shell with sudo. Without sudo, the root login normally fails because local root access is tied to the Linux administrator account through socket authentication.
sudo mariadb
Run SQL statements from the MariaDB prompt, then type EXIT; or press Ctrl+D to close the session.
SELECT VERSION();
EXIT;
Verify Root Authentication
The plugin column in mysql.user can be misleading on current MariaDB packages because the account may show mysql_native_password while still allowing unix_socket as an alternate method. Use SHOW CREATE USER for the complete authentication rule.
SHOW CREATE USER root@localhost\G
Relevant output includes the socket authentication option.
CREATE USER for root@localhost: CREATE USER `root`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket
Manage the MariaDB Service
Use systemd when you need to stop, restart, reload, or disable MariaDB.
sudo systemctl stop mariadb
sudo systemctl restart mariadb
sudo systemctl reload mariadb
sudo systemctl disable mariadb
Create a Database and Application User
Create databases and application users from the MariaDB shell. This example grants one user access to one database from localhost only.
CREATE DATABASE myapp;
CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password_here';
GRANT ALL PRIVILEGES ON myapp.* TO 'myapp_user'@'localhost';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'myapp_user'@'localhost';
Relevant output should show privileges only for the selected database.
+----------------------------------------------------------------+ | Grants for myapp_user@localhost | +----------------------------------------------------------------+ | GRANT USAGE ON *.* TO `myapp_user`@`localhost` | | GRANT ALL PRIVILEGES ON `myapp`.* TO `myapp_user`@`localhost` | +----------------------------------------------------------------+
Test the new user account from the shell.
mariadb -u myapp_user -p myapp
Check Localhost Binding and Firewall Scope
MariaDB binds to localhost by default, which is the safe setup when the application and database run on the same server. Use grep to confirm the packaged server configuration; the grep command guide covers the filter syntax in more detail.
sudo grep -E '^bind-address' /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 127.0.0.1
If a separate application server must connect to MariaDB, change
bind-address, create a least-privilege database user for that source host, and allow only the required source IPs through UFW. The guide on configuring UFW on Ubuntu covers source-limited firewall rules.
Use MariaDB with Web Applications
MariaDB commonly sits behind a PHP web stack. Pair it with Nginx on Ubuntu or Apache on Ubuntu, then add PHP on Ubuntu for a LEMP or LAMP stack. For complete application flows, see the guides for installing WordPress with Nginx, MariaDB, and PHP on Ubuntu or installing phpMyAdmin with Nginx on Ubuntu.
MariaDB 11.8 Features and Version Notes
MariaDB 11.8 is a community LTS release maintained until June 4, 2028. MariaDB 11.4 has a longer community maintenance window, so choose 11.8 for its newer features rather than for the longest possible branch lifetime. The MariaDB maintenance policy lists the current support dates.
Vector Search
MariaDB 11.8 includes MariaDB Vector support. The VECTOR type stores embeddings, while vector indexes and distance functions support similarity search for recommendations, semantic search, and retrieval-augmented generation workflows.
CREATE TABLE documents (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255),
body TEXT,
embedding VECTOR(3) NOT NULL,
VECTOR INDEX (embedding) M=8 DISTANCE=cosine
) ENGINE=InnoDB;
The vector dimension must match your embedding model. The small VECTOR(3) example is only for a quick syntax check; real embedding models usually produce much larger vectors.
INSERT INTO documents (title, body, embedding) VALUES
('Cache Layer', 'Stores repeated database results', VEC_FromText('[0.12,-0.34,0.56]'));
SELECT title
FROM documents
ORDER BY VEC_DISTANCE_COSINE(embedding, VEC_FromText('[0.15,-0.32,0.51]'))
LIMIT 1;
Extended TIMESTAMP Range and UTF-8 Defaults
MariaDB 11.8 extends TIMESTAMP handling from the old 2038 boundary to 2106 for most tables, reducing one common long-term date-storage risk. New databases also default to utf8mb4, which is the practical Unicode default for modern application data.
Parallel Logical Backup and Restore
mariadb-dump supports directory output with --dir and parallel work with --parallel. This is useful when a large database set is better stored as per-table files instead of one SQL stream.
mkdir -p "$HOME/mariadb-backup"
mariadb-dump --dir="$HOME/mariadb-backup" --parallel=4 --databases myapp analytics
Restore the directory dump with mariadb-import.
mariadb-import --dir="$HOME/mariadb-backup" --parallel=4
Troubleshoot MariaDB 11.8
Cannot Connect Through the Local Socket
Error: ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock'
This usually means the service is stopped or failed before creating its socket.
systemctl status mariadb --no-pager
Start the service if it is inactive.
sudo systemctl start mariadb
If it fails again, inspect the MariaDB unit journal.
sudo journalctl -xeu mariadb.service
Access Denied for Root
Error: ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Use sudo mariadb for local root access. If you need an application login, create a dedicated user instead of weakening the root account.
sudo mariadb
Host Localhost Is Not Allowed
Error: Host 'localhost' is not allowed to connect to this MariaDB server
This usually means the account exists for a different host value, or the account was removed. Check the user and host pairs first.
SELECT User, Host FROM mysql.user WHERE User='myapp_user';
If no myapp_user entry exists for localhost, create the local account and grant only the database it needs.
CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password_here';
GRANT ALL PRIVILEGES ON myapp.* TO 'myapp_user'@'localhost';
FLUSH PRIVILEGES;
MariaDB Repository Errors on 24.04 or 22.04
If apt update reports NO_PUBKEY or the package candidate stays on the Ubuntu default branch, verify the source file and keyring path.
cat /etc/apt/sources.list.d/mariadb.sources
ls -lh /etc/apt/keyrings/mariadb-keyring.gpg
Then refresh APT and recheck the package candidate.
sudo apt update
apt-cache policy mariadb-server
The Suites: line should match your release codename: noble for Ubuntu 24.04 or jammy for Ubuntu 22.04.
Service Fails After a Major Upgrade
After upgrading an existing database from 10.11 or 10.6 to 11.8, run the upgrade utility once the service is running.
sudo mariadb-upgrade
If MariaDB cannot start, inspect the journal before trying manual recovery modes.
sudo journalctl -xeu mariadb.service
Remove MariaDB 11.8
Remove Packages and Preserve Data
Stop MariaDB and remove the server and client packages while keeping database files and configuration available for a future reinstall.
sudo systemctl stop mariadb
sudo apt remove mariadb-server mariadb-client -y
Data remains under /var/lib/mariadb/ on Ubuntu 26.04 and under /var/lib/mysql/ on Ubuntu 24.04 and 22.04. Configuration remains under /etc/mysql/.
Purge Packages and Delete Data
These removal commands permanently delete local MariaDB databases and configuration. Export or copy any data you need before running them.
sudo systemctl stop mariadb
sudo apt purge mariadb-server mariadb-client mariadb-common -y
sudo rm -rf /var/lib/mariadb /var/lib/mysql /etc/mysql
Clear packages that became unused only because MariaDB was removed. Review APT’s preview before accepting a broad cleanup on reused servers.
sudo apt autoremove --purge
Remove the MariaDB.org Repository
On Ubuntu 24.04 and 22.04, remove the repository source and dedicated keyring if you added them for the 11.8 install path.
sudo rm -f /etc/apt/sources.list.d/mariadb.sources
sudo rm -f /etc/apt/keyrings/mariadb-keyring.gpg
sudo apt update
Official MariaDB Resources
- MariaDB Foundation: Project news, downloads, and community information.
- MariaDB 11.8 changes and improvements: Official feature summary for the 11.8 branch.
- MariaDB Vector project: Vector search documentation, examples, and integrations.
- mariadb-dump documentation: Reference for logical backup options such as
--dirand--parallel.
Conclusion
MariaDB 11.8 is running on Ubuntu with the correct package source for your release, either Ubuntu’s default 26.04 repository or MariaDB.org on 24.04 and 22.04. From here, secure the service, create least-privilege application users, and connect it to your web stack only through the local socket or a tightly scoped firewall rule.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><a href="https://example.com">link</a><blockquote>quote</blockquote>