How7o
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to Install MariaDB 11.4 LTS on Ubuntu 24.04 (Fresh Install, Secured)
Share
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Server Management > How to Install MariaDB 11.4 LTS on Ubuntu 24.04 (Fresh Install, Secured)
Server Management

How to Install MariaDB 11.4 LTS on Ubuntu 24.04 (Fresh Install, Secured)

how7o
By how7o
Last updated: May 24, 2026
10 Min Read
MariaDB 11.4 LTS database cylinder being installed on Ubuntu
SHARE

Ubuntu’s default MariaDB package lags the upstream release by 1–2 major versions, which means missing features, slower release of security fixes, and shorter support windows. This guide shows how to install MariaDB on Ubuntu 24.04 from the official MariaDB APT repository — specifically the 11.4 LTS branch, which has support through 2029 — plus the secure-install ritual, sensible my.cnf defaults, and the gotchas if you’re migrating from MySQL.

Contents
  • TL;DR
  • Why use the official MariaDB repo (not Ubuntu’s)
  • Step 1 — Add the MariaDB APT repository
  • Step 2 — Install MariaDB server and client
  • Step 3 — Run the secure-installation wizard
  • Step 4 — Create your application database and user
  • Step 5 — Set sensible defaults in my.cnf
  • Migrating from MySQL
  • Troubleshooting
    • "Access denied for user 'root'@'localhost'"
    • "Port 3306 already in use"
  • Related guides

TL;DR

Add MariaDB’s official repository with their setup script, apt install mariadb-server mariadb-client, run mariadb-secure-installation, create your application database and user, and set character-set-server = utf8mb4 in /etc/mysql/mariadb.conf.d/50-server.cnf. The whole sequence is about ten minutes on a fresh VPS.

Why use the official MariaDB repo (not Ubuntu’s)

  • Current versions. Ubuntu 24.04 ships MariaDB 10.11. MariaDB 11.4 LTS is the current stable LTS with support through July 2029.
  • Faster security patches. MariaDB Foundation ships fixes within days; Ubuntu’s process adds 1–4 weeks of backport delay.
  • Identical packaging. The official packages keep Ubuntu’s package names, service names, and config layouts. You’re not switching distributions, just sources.

Step 1 — Add the MariaDB APT repository

MariaDB provides a one-shot setup script that picks the right repo for your distro version, installs the signing key, and writes the apt sources file:

curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-11.4"

The --mariadb-server-version flag pins to the 11.4 LTS series. Without it, the script picks the latest stable, which might be a short-term release (11.5, 11.6) with shorter support.

If you’d rather inspect what the script does before running it, fetch and read it first: curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup > setup.sh && less setup.sh. It’s ~200 lines of bash and self-explanatory.

Step 2 — Install MariaDB server and client

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

The server starts immediately and is enabled to boot with systemd. Confirm:

sudo systemctl status mariadb
mariadb --version

You should see Server version: 11.4.x-MariaDB or similar.

MariaDB install flow — repo add, apt install, secure setup, create DB and user

Step 3 — Run the secure-installation wizard

sudo mariadb-secure-installation

It will ask seven questions. The defaults are sensible for almost every production install:

  • Current root password? Press Enter — there isn’t one yet on a fresh install.
  • Switch to unix_socket authentication? Yes. This is the modern MariaDB default: root connects via Unix socket as the OS root user, no password needed locally. Remote root access is disabled.
  • Change the root password? No (since you’re using unix_socket).
  • Remove anonymous users? Yes.
  • Disallow root login remotely? Yes.
  • Remove test database? Yes.
  • Reload privilege tables now? Yes.

Step 4 — Create your application database and user

Drop into the MariaDB shell as root (now via unix_socket — no password):

sudo mariadb

Create a database and a user that owns it. Use a strong password — generate one with openssl rand -base64 24 if you don’t have a password manager open:

CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'myapp'@'localhost' IDENTIFIED BY 'long-random-password-here';
GRANT ALL PRIVILEGES ON myapp.* TO 'myapp'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The utf8mb4 character set is essential — it’s the only one that supports the full Unicode range, including emoji and many Asian-language characters. The older utf8 (alias for utf8mb3) silently breaks on 4-byte characters. Always use utf8mb4 for new databases.

Step 5 — Set sensible defaults in my.cnf

Edit /etc/mysql/mariadb.conf.d/50-server.cnf and ensure these are set under [mariadbd]:

[mariadbd]
character-set-server   = utf8mb4
collation-server       = utf8mb4_unicode_ci
default-storage-engine = InnoDB

# InnoDB buffer pool: 50-70% of system RAM on a DB-dedicated server
innodb_buffer_pool_size = 1G

# Log slow queries above 1 second
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 1

# Bind only to localhost unless you need remote access
bind-address = 127.0.0.1

Restart for the changes to apply:

sudo systemctl restart mariadb

The innodb_buffer_pool_size is the single most impactful setting. On a 4 GB VPS dedicated to the database, set it to 2–3 GB. On a shared server running PHP + nginx + MariaDB on 2 GB, 512 MB is safer. Too high and the OS starts swapping; too low and you’re hitting disk constantly for queries that should be in memory.

Migrating from MySQL

MariaDB is a drop-in replacement for MySQL up through MySQL 5.7. For MySQL 8.0+, there are minor compatibility gaps (notably JSON functions and CTE behaviour) but most applications run unchanged. The migration is:

  1. Dump every database from MySQL: mysqldump --all-databases --single-transaction --routines --triggers > backup.sql
  2. Stop MySQL: sudo systemctl stop mysql
  3. Install MariaDB (this guide).
  4. Load the dump: sudo mariadb
  5. Restart your applications — most won't notice the swap. WordPress, Laravel, Django, and Rails are all MariaDB-compatible without code changes.

Troubleshooting

"Access denied for user 'root'@'localhost'"

You're trying to connect as root via password but MariaDB's secure install switched you to unix_socket. Use sudo mariadb (sudo to switch OS users, no password needed). For password-based root access, edit the user inside the shell: ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('newpass');

"Port 3306 already in use"

Another database is bound to the port — usually a leftover MySQL install. Check with sudo lsof -i :3306, stop the offending service, and either remove it (sudo apt remove mysql-server) or move it to a different port via its own config.

Is MariaDB really a drop-in replacement for MySQL in 2026?

Up to MySQL 5.7, yes — schema and SQL syntax match. For MySQL 8.0+, MariaDB has diverged on a few features: JSON path functions are slightly different, default authentication plugins differ, and some 8.0 features (window function frames, lateral derived tables) lag MariaDB by a release or two. For typical web-app workloads (WordPress, Laravel, Django, Rails) the swap is invisible. For high-end MySQL 8.0 features, audit first.

Why 11.4 LTS specifically?

MariaDB has two release streams — rolling short-term releases (5–6 month support) and long-term LTS (5 years support). 11.4 is the current LTS, released May 2024, supported until July 2029. The short-term releases (11.5, 11.6) are fine for desktop and dev environments but not what you want for a production server.

Should I run MariaDB in Docker instead of on the host?

For a single-app server, install on the host — simpler operationally and one less abstraction layer. For multi-service hosts, Docker (or Podman) is fine, especially with a docker-compose pattern that keeps data volumes outside the container. The performance penalty is negligible on modern Linux.

Can I run MariaDB and MySQL on the same server?

Yes, by binding them to different ports (3306 and 3307 are common). They're separate daemons with separate data directories. The MariaDB and MySQL packages will conflict if installed via the same package manager; install one from apt and the other via tarball or Docker.

What backup strategy should I use?

For dev/staging: mariadb-dump on a cron job, store output in S3 / R2 / Backblaze B2. For production: combine logical (mariadb-dump) with physical (mariabackup, the modern replacement for xtrabackup). Mariabackup gives you hot backups without locking tables. Test restores monthly — backups you've never restored are not backups.

How big can innodb_buffer_pool_size go?

On a database-dedicated server, 50–70% of system RAM. Above that, the OS doesn't have enough memory for file cache and you start hitting swap. On a shared server (DB + PHP + nginx), aim for 25–40% of total RAM. The dataset's hot set is what fits matters — if your active queries touch 200 MB of data, a 2 GB buffer pool helps more than 8 GB.

Related guides

  • Install MySQL on Ubuntu — the upstream alternative if you'd rather stay with Oracle's distribution.
  • Restart MariaDB server — the most-needed operational command.
  • MariaDB not starting — troubleshooting — what to check when systemd reports the service failed.
  • Disable MySQL binary logging — relevant if you don't need replication and want to reclaim disk space.

For full configuration reference and release notes, the MariaDB Server documentation is canonical.

TAGGED:configurationinstallationmariadbmysqlUbuntu

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article fail2ban shield blocking incoming brute-force probes, log file feeding the scanner How to Install fail2ban on Ubuntu (SSH, nginx, and WordPress Filters)
Next Article MySQL primary and replica database cylinders connected by replication arrows How to Set Up MySQL Primary-Replica Replication on Ubuntu (Production Guide)
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow
Most Popular
Bun runtime — faster JS toolkit replacing npm in Laravel projects
How to Install Bun Runtime on Ubuntu (And Use It in a Laravel Project)
May 24, 2026
Tailscale mesh — peer-to-peer connections between devices, coordination server
How to Install Tailscale on Ubuntu (Zero-Config Mesh VPN for Self-Hosters)
May 24, 2026
Caddy server — automatic HTTPS, 3-line Caddyfile vs 25-line nginx config
How to Install Caddy Server on Ubuntu (Automatic HTTPS, Drop-in nginx Alternative)
May 24, 2026
Cloudflare Tunnel — outbound-only connection from server, no inbound port forward
How to Install Cloudflare Tunnel on Ubuntu (Expose Local Services, No Port Forwarding)
May 24, 2026
WireGuard encrypted tunnel between server and clients with lock icons
How to Set Up WireGuard VPN on Ubuntu (Server, Linux Client, and iOS)
May 24, 2026

You Might Also Like

Laravel run without .env file — env() fallback in config/app.php
Web Development

How to Run a Laravel Project Without a .env File

8 Min Read
Safely remove MySQL binary log files to free disk space
Server Management

How to Safely Clean Up MySQL Binary Log Files

5 Min Read
Laravel Eloquent records today — Carbon today helper and whereDate illustration
Web Development

How to Get Records Created Today in Laravel

6 Min Read
Check Linux OS name and version from the command line
Server Management

How to Check the Linux OS Name and Version from the Command Line

4 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Tools

  • Age Calculator
  • Word Counter
  • Image Upscaler
  • Password Generator
  • QR Code Generator
  • See all tools→

Pranks

  • Fake Blue Screen Prank
  • Hacker Typer
  • Fake iMessage Generator
  • Windows XP Crash Prank
  • Windows 11 Update Prank
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?