MariaDB 11.4 is the Ubuntu install target when an application stack needs a long-maintenance MariaDB LTS branch instead of the older Ubuntu defaults on 24.04 and 22.04. Ubuntu 26.04 already includes a newer MariaDB branch in main, so 26.04 readers can install MariaDB directly from Ubuntu without adding the incompatible 11.4 repository.
Use Ubuntu’s main package on Ubuntu 26.04 when you want the supported MariaDB package maintained through Ubuntu updates. Use the MariaDB.org 11.4 workflow on Ubuntu 24.04 LTS and Ubuntu 22.04 LTS when a fixed LTS database branch matters more than staying with the older package selected by the Ubuntu archive. If you only want the default package for your release, use the general MariaDB installation guide for Ubuntu.
Install MariaDB on Ubuntu
Choose the install path by Ubuntu release, branch requirement, and update owner before adding any repository source. Ubuntu 26.04 installs MariaDB from Ubuntu main. The MariaDB.org 11.4 repository currently publishes Ubuntu metadata for noble and jammy, but not resolute.
| Ubuntu Release | Default MariaDB Candidate | MariaDB.org 11.4 Availability | Best Path |
|---|---|---|---|
| Ubuntu 26.04 LTS (resolute) | 11.8.x from Ubuntu main | No resolute suite for 11.4 | Install from Ubuntu main unless you specifically need a MariaDB.org 11.8 repository package. |
| Ubuntu 24.04 LTS (noble) | 10.11.x from Ubuntu universe updates | Available from the MariaDB.org 11.4 repository | Use MariaDB.org 11.4 when your application needs that fixed LTS branch instead of Ubuntu’s 10.11 package. |
| Ubuntu 22.04 LTS (jammy) | 10.6.x from Ubuntu universe updates | Available from the MariaDB.org 11.4 repository | Use MariaDB.org 11.4 when you have tested the upgrade from the older 10.6 branch and need a longer LTS runway. |
Use only one MariaDB package source for the branch you install. Do not point Ubuntu 26.04 at an older
nobleorjammyrepository as a workaround, 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 adding a MariaDB repository or installing database packages.
sudo apt update
These commands use
sudofor package installation, repository setup when used, and service management. If your account cannot run administrator commands yet, add it with the guide to add a user to sudoers on Ubuntu.
Apply pending package upgrades before changing a database server on long-running systems.
sudo apt upgrade
Install MariaDB from Ubuntu Main on 26.04
Ubuntu 26.04 provides MariaDB 11.8 from the main archive. This path does not need a MariaDB.org source file or signing key.
apt-cache policy mariadb-server
Relevant output on Ubuntu 26.04 shows the resolute/main candidate.
mariadb-server:
Installed: (none)
Candidate: 1:11.8.6-5
Version table:
1:11.8.6-5 500
500 http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages
Install the database server and terminal client from Ubuntu’s archive.
sudo apt install mariadb-server mariadb-client
Verify the installed version, service state, server version, and data directory before configuring applications.
mariadb --version
systemctl is-active mariadb
systemctl is-enabled mariadb
sudo mariadb -NBe "SELECT VERSION();"
sudo mariadb -NBe "SELECT @@datadir;"
Ubuntu 26.04 should show the 11.8 branch, an active and enabled service, and the package-owned data directory under /var/lib/mariadb/.
mariadb from 11.8.6-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper active enabled 11.8.6-MariaDB-5 from Ubuntu /var/lib/mariadb/
Continue with the security and management sections after the 26.04 install. The MariaDB.org repository steps are only for Ubuntu 24.04 and 22.04 systems that need MariaDB 11.4.
Install MariaDB.org Repository Tools
For the Ubuntu 24.04 or 22.04 MariaDB 11.4 path, install curl for the key download, ca-certificates for HTTPS certificate validation, and gpg for converting the signing key into an APT keyring. The curl command guide explains the download flags used in repository setup commands.
sudo apt install curl ca-certificates gpg
Import the MariaDB Signing Key
MariaDB publishes an ASCII-armored signing key. Store the dearmored keyring under /etc/apt/keyrings/ so only the MariaDB source file uses it.
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
Verify the saved key fingerprint if you want to audit the trust file before APT uses it.
gpg --quiet --show-keys --with-fingerprint /etc/apt/keyrings/mariadb-keyring.gpg
Relevant output includes the MariaDB signing key fingerprint.
pub rsa4096 2016-03-30 [SC]
177F 4010 FE56 CA33 3630 0305 F165 6F24 C74C D1D8
uid MariaDB Signing Key <signing-key@mariadb.org>
sub rsa4096 2016-03-30 [E]
Add the MariaDB 11.4 Repository
Create a DEB822 source file for Ubuntu 24.04 or 22.04 only. The guard checks the Ubuntu codename and APT architecture before it writes anything to /etc/apt/sources.list.d/.
. /etc/os-release
codename="${VERSION_CODENAME:-}"
arch="$(dpkg --print-architecture)"
case "${codename}:${arch}" in
noble:amd64|noble:arm64|noble:ppc64el|noble:s390x|jammy:amd64|jammy:arm64|jammy:ppc64el|jammy:s390x)
printf '%s\n' \
'X-Repolib-Name: MariaDB 11.4' \
'Types: deb' \
'URIs: https://deb.mariadb.org/11.4/ubuntu' \
"Suites: ${codename}" \
'Components: main' \
"Architectures: ${arch}" \
'Signed-By: /etc/apt/keyrings/mariadb-keyring.gpg' | sudo tee /etc/apt/sources.list.d/mariadb.sources > /dev/null
;;
*)
printf 'MariaDB 11.4 repository packages are available for Ubuntu 24.04 noble and 22.04 jammy on supported MariaDB architectures, not %s/%s.\n' "${codename:-unknown}" "${arch}" >&2
;;
esac
If the command prints the unsupported-release message, stop the 11.4 install path. Ubuntu 26.04 users should use the Ubuntu main method earlier in this section instead of forcing an older suite.
Verify the MariaDB 11.4 Repository
Refresh APT metadata and confirm the MariaDB.org repository is the selected source 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.4.11+maria~ubu2404
Version table:
1:11.4.11+maria~ubu2404 500
500 https://deb.mariadb.org/11.4/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 package until the upgrade transaction completes.
mariadb-server:
Installed: (none)
Candidate: 1:11.4.11+maria~ubu2204
Version table:
1:11.4.11+maria~ubu2204 500
500 https://deb.mariadb.org/11.4/ubuntu jammy/main amd64 Packages
Install MariaDB 11.4 Server and Client
Install the database server and terminal client from the MariaDB.org repository. Review APT’s package list before confirming, especially on systems that already run MySQL or MariaDB packages.
sudo apt install mariadb-server mariadb-client
The repository packages initialize the database under /var/lib/mysql/, install configuration under /etc/mysql/, and enable mariadb.service. The install also pulls required companion packages such as galera-4, server core files, client core files, and compatibility command names.
Verify MariaDB 11.4
Check the installed client version, service state, and local SQL access before connecting applications.
mariadb --version
systemctl is-active mariadb
systemctl is-enabled mariadb
sudo mariadb -NBe "SELECT VERSION();"
Relevant output should show the 11.4 branch, an active and enabled service, and the matching server version.
mariadb from 11.4.11-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper active enabled 11.4.11-MariaDB-ubu2404
Ubuntu 22.04 reports the same MariaDB branch with an ubu2204 build suffix. Future patch releases may show a newer 11.4.x value.
Install the MariaDB Client Only
If the Ubuntu machine only needs to connect to a remote database, install the client package without the local server. Ubuntu 26.04 can install the client from main; Ubuntu 24.04 and 22.04 should add the MariaDB.org repository first when the client must match the 11.4 branch.
sudo apt install mariadb-client
Connect with the remote host, database user, and database name supplied by your administrator or application stack.
mariadb -h db.example.com -u myapp_user -p myapp
Secure MariaDB on Ubuntu
Check the MariaDB Service
The package normally starts MariaDB during installation. Use compact service checks before running security or administration commands.
systemctl is-active mariadb
systemctl is-enabled mariadb
Expected output shows the service is running and enabled at boot.
active enabled
Start and enable the service if either check reports an inactive or disabled state.
sudo systemctl enable --now mariadb
Verify Root Authentication
Fresh Ubuntu 26.04 and MariaDB.org 11.4 installs allow local administrative access through sudo mariadb. Check the root account definition with SHOW CREATE USER because the complete rule can include both a password placeholder and the Unix socket method.
sudo mariadb -NBe "SHOW CREATE USER root@localhost\\G"
Relevant output includes the socket authentication option.
CREATE USER `root`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket
Use separate database users for applications instead of weakening the database root account or embedding root credentials in scripts.
Run the Security Script
MariaDB ships an interactive hardening script that reviews anonymous users, remote root login, default test databases, and privilege-table reloads. Use the MariaDB command name; the MySQL-era command name may exist as a compatibility helper, but new instructions should use the current tool.
sudo mariadb-secure-installation
On a fresh socket-authenticated install, press Enter at the current root password prompt unless you already set one. For production systems, remove anonymous users, disallow remote root login, remove the test database, and reload privilege tables unless your environment has a specific reason to keep a default object.
Manage MariaDB on Ubuntu
Connect as the Database Root User
Open the MariaDB shell with sudo for local administration.
sudo mariadb
Run a quick SQL check, then type EXIT; or press Ctrl+D to close the session.
SELECT VERSION();
EXIT;
Manage the MariaDB Service
Use systemd when you need to stop, restart, disable, or re-enable the database service.
sudo systemctl stop mariadb
sudo systemctl restart mariadb
sudo systemctl disable mariadb
sudo systemctl enable --now mariadb
Restart MariaDB after configuration changes. The repository unit does not need a separate reload command for the basic workflows covered here.
Create a Database and Application User
Create application databases and users from the MariaDB shell. This example grants one local user access to one database.
CREATE DATABASE myapp;
CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'change_this_password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON myapp.* TO 'myapp_user'@'localhost';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'myapp_user'@'localhost';
Relevant output should show privileges for the selected database, not broad administrative grants.
+-------------------------------------------------------------------------------------------------------+ | Grants for myapp_user@localhost | +-------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO `myapp_user`@`localhost` | | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `myapp`.* TO `myapp_user`@`localhost` | +-------------------------------------------------------------------------------------------------------+
Test the new user account with the database name it should access.
mariadb -u myapp_user -p myapp
Check Localhost Binding and Firewall Scope
MariaDB binds to localhost by default, which is the safer setup when the application and database run on the same server. Filter the packaged configuration to inspect the active bind address.
sudo grep -E '^bind-address' /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 127.0.0.1
Opening MariaDB to a network changes the threat model. Change
bind-addressonly when a separate application server needs access, create a host-restricted database user, and allow only the required source IPs through UFW. The guide on configuring UFW on Ubuntu covers source-limited 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 full application workflows, see the guides for installing WordPress with Nginx, MariaDB, and PHP on Ubuntu or installing phpMyAdmin with Nginx on Ubuntu.
MariaDB 11.4 LTS Notes
MariaDB 11.4 is a community LTS branch maintained until May 29, 2029, according to the MariaDB Server maintenance policy. That makes 11.4 the longer community-maintained branch compared with 11.8, while 11.8 carries newer features such as MariaDB Vector.
Choose 11.4 for Long LTS Compatibility
Choose MariaDB 11.4 when an application stack is certified on that branch, when you want a long LTS runway on Ubuntu 24.04 or 22.04, or when you are moving from MariaDB 10.11 or 10.6 but do not want the newer 11.8 feature set yet. Do not downgrade a live 11.8 system to 11.4 without a tested backup and restore plan.
Review Upgrade-Relevant Changes
MariaDB’s 11.4 changes include optimizer improvements, online schema change behavior for many ALTER TABLE operations, InnoDB maintenance changes, and removal of some deprecated features. Read the official MariaDB 11.4 changes and improvements before upgrading production databases, especially if applications depend on older optimizer behavior or deprecated variables.
Back Up Before Major Upgrades
Export a logical backup before switching an existing database from Ubuntu’s default MariaDB branch to 11.4. Keep a copy off the database host and test restores regularly instead of assuming a dump is usable.
sudo mariadb-dump --all-databases > "mariadb-all-$(date +%Y%m%d).sql"
Do not copy
/var/lib/mysqlwhile MariaDB is running unless you use a database-aware backup method. Raw file copies can capture inconsistent table state and fail during restore.
Troubleshoot MariaDB on Ubuntu
Repository Is Unsupported on Ubuntu 26.04
The MariaDB.org 11.4 repository does not currently publish a resolute suite. If your source file points Ubuntu 26.04 at resolute, APT cannot refresh that repository.
Remove the unsupported source file, then use the Ubuntu main install path for Ubuntu 26.04. If you need MariaDB.org-built 11.8 packages instead, use the dedicated guide to install MariaDB 11.8 on Ubuntu after the broken 11.4 source is gone.
sudo rm -f /etc/apt/sources.list.d/mariadb.sources
sudo apt update
apt-cache policy mariadb-server
Ubuntu 26.04 should return an 11.8 candidate from the Ubuntu resolute archive after the unsupported source is removed. That confirms the broken 11.4 source is gone and the default install path is available again.
mariadb-server:
Installed: (none)
Candidate: 1:11.8.6-5
Version table:
1:11.8.6-5 500
500 http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages
Package Candidate Stays on 10.11 or 10.6
If apt-cache policy mariadb-server still shows Ubuntu’s default 10.11 or 10.6 package after repository setup, inspect the source file, keyring path, and package candidate together.
cat /etc/apt/sources.list.d/mariadb.sources
ls -lh /etc/apt/keyrings/mariadb-keyring.gpg
sudo apt update
apt-cache policy mariadb-server
The Suites: value must match your release: noble for Ubuntu 24.04 or jammy for Ubuntu 22.04. A missing keyring or wrong suite leaves APT on the default Ubuntu branch.
Cannot Connect Through the Local Socket
A stopped or failed service usually produces a local socket error.
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock'
Check the service state before changing configuration files.
systemctl is-active mariadb
Start MariaDB if the service is inactive, then retest the same state check.
sudo systemctl start mariadb
systemctl is-active mariadb
active
If the service fails again, read the recent unit journal.
sudo journalctl -u mariadb --no-pager -n 40
Application User Gets Access Denied
MariaDB account matching includes both the user name and host value. A user created as 'myapp_user'@'localhost' is not the same account as 'myapp_user'@'192.168.1.100'.
SELECT User, Host FROM mysql.user WHERE User='myapp_user';
Create the host-specific account that matches the connection path, then retest with the application credentials.
CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'change_this_password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON myapp.* TO 'myapp_user'@'localhost';
FLUSH PRIVILEGES;
Service Fails After a Major Upgrade
After upgrading an existing database from MariaDB 10.11 or 10.6 to 11.4, run the upgrade utility once the service is running.
sudo mariadb-upgrade
If MariaDB cannot start, inspect the journal and restore from backup rather than repeatedly changing package sources.
sudo journalctl -xeu mariadb.service
Update or Remove MariaDB on Ubuntu
Update MariaDB Packages
APT updates MariaDB from the source that owns the installed packages. Ubuntu 26.04 updates the main package through Ubuntu’s normal package sources, while Ubuntu 24.04 and 22.04 update MariaDB 11.4 from MariaDB.org while the source file remains enabled. Use --only-upgrade when you want to update installed MariaDB packages without installing them on systems where they are missing.
sudo apt update
sudo apt install --only-upgrade mariadb-server mariadb-client mariadb-common
Major-version switches, such as moving from 11.4 to 11.8 or changing from Ubuntu packages to MariaDB.org packages, are migrations rather than routine package updates. Back up the database and read the release notes before changing branches or sources.
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
Database files remain under the package-owned data directory: /var/lib/mariadb/ on Ubuntu 26.04 and /var/lib/mysql/ for the MariaDB.org 11.4 packages validated on Ubuntu 24.04 and 22.04. Configuration remains under /etc/mysql/, and logs commonly remain under /var/log/mysql/. If APT reports unused dependencies, preview the cleanup before removing them.
sudo apt autoremove --dry-run
If the preview only lists MariaDB-related packages you no longer need, run the cleanup without the dry run.
sudo apt autoremove
Purge Packages and Delete Data
These commands permanently delete local MariaDB databases, logs, and configuration. Export or copy any data you need first, and do not run the data deletion command if another MySQL-compatible server still uses the same paths.
Purge package-managed configuration files when you want a stronger reset than normal removal. If the package asks whether to remove all MariaDB databases, answer yes only after your backup is complete. Answer no and use the preserve-data removal path if you want to keep /var/lib/mariadb/ or /var/lib/mysql/.
sudo systemctl stop mariadb
sudo apt purge mariadb-server mariadb-client mariadb-common
Preview autoremovable dependency packages such as server core, client core, Galera, and provider plugins before purging them.
sudo apt autoremove --purge --dry-run
If the preview lists only MariaDB-related packages you no longer need, purge the remaining dependencies.
sudo apt autoremove --purge
Preview the remaining MariaDB paths before deleting database state. No output means those paths are already absent.
sudo find /var/lib/mariadb /var/lib/mysql /var/log/mysql /etc/mysql -maxdepth 0 -print 2>/dev/null
Delete only the paths you are ready to lose permanently.
sudo rm -rf /var/lib/mariadb /var/lib/mysql /var/log/mysql /etc/mysql
Remove the MariaDB.org Repository
Remove the repository source after MariaDB.org packages are removed or intentionally migrated away. Keep the keyring if another remaining MariaDB source still references it.
sudo rm -f /etc/apt/sources.list.d/mariadb.sources
if ! grep -Rqs "/etc/apt/keyrings/mariadb-keyring.gpg" /etc/apt/sources.list.d /etc/apt/sources.list 2>/dev/null; then
sudo rm -f /etc/apt/keyrings/mariadb-keyring.gpg
fi
sudo apt update
Official MariaDB Resources
- MariaDB downloads: Official download and repository entry point for community packages.
- MariaDB Server maintenance policy: Current LTS release dates and maintenance windows.
- MariaDB 11.4 changes and improvements: Official branch feature and upgrade notes.
- mariadb-upgrade documentation: Reference for post-upgrade checks after a major-version change.
Conclusion
MariaDB is installed from Ubuntu main on Ubuntu 26.04 or from the official MariaDB.org 11.4 repository on Ubuntu 24.04 and 22.04, with a verified service, socket-authenticated root access, and a clear update and removal path. From here, connect it to your application stack through local access first, then add host-restricted network access only when the database must serve a separate application host.


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><blockquote>quote</blockquote>