Setting up a database on Debian or Ubuntu means installing its packages and confirming the server starts. MariaDB is a database server that stores structured information and answers SQL queries from applications or a client program.
I’ll show you how to install MariaDB from the distribution repositories and check that its service is running.
TL;DR
Install MariaDB from your Debian or Ubuntu APT repositories, then check the service and connect locally.
sudo apt update
sudo apt install mariadb-server mariadb-client
sudo systemctl status mariadb
sudo mariadb
The APT package version follows the distribution release. Use MariaDB’s upstream repository only when you have a reason to select a different supported series.
What Is MariaDB on Debian and Ubuntu?
MariaDB is a relational database server that stores structured information and accepts SQL queries from applications or a client program.
A database groups tables, and tables hold records in rows and columns. MariaDB accounts and grants control which clients can access those records.
systemd controls MariaDB’s service on current Debian and Ubuntu systems. For package-manager basics, see our guide to the apt and apt-get commands.
How to Install MariaDB on Debian and Ubuntu
Install the server and client packages from the configured distribution repositories.
Step 1: Refresh the APT package index
APT’s package index stores available package metadata, and refreshing it requests current information from the repositories configured on your system.
sudo apt update
Refreshing the index does not upgrade installed software. A full system upgrade is separate from adding MariaDB. Resolve repository errors before continuing, and do not add another source as a workaround.
Step 2: Install the server and client
The server package runs the database. The client package provides terminal access to it.
sudo apt install mariadb-server mariadb-client
APT shows the proposed packages and download size before installation. Review the summary and accept only if the server and client packages match your request. A package version follows the OS release and its configured repositories, not necessarily MariaDB’s newest upstream series.
Consult MariaDB’s official repository setup instructions for your OS release when you need a newer supported series, and avoid copying a repository line for a different Debian or Ubuntu codename.
Step 3: Check the service and connect locally
MariaDB normally starts as a systemd service after package installation. Check its state, then open a local administrative session:
sudo systemctl status mariadb
sudo mariadb
An active status means systemd sees the service running, while a successful local login checks authentication separately. If the unit is inactive, read its status and recent log messages before changing configuration.
When no underlying error remains and the service is stopped, start it with systemctl. Enable boot startup separately only if this machine should run the database after a reboot.
sudo systemctl start mariadb
sudo systemctl enable mariadb
Check the MariaDB Service and Handle Common Choices
These commands check boot configuration, the client version and security-helper choices.
sudo systemctl is-enabled mariadb
This command checks whether systemd is configured to launch MariaDB during boot. To print the installed client version, run:
mariadb --version
mariadb Ver 15.1 Distrib 10.11.14-MariaDB, for debian-linux-gnu (aarch64) using EditLine wrapper

I ran this command on the current workspace server, and it identified the client as MariaDB 10.11.14. The version available on another system can differ with its Debian or Ubuntu release.
MariaDB provides a security helper named mariadb-secure-installation, though some package versions also provide mysql_secure_installation. Check which command exists before running it, then review its prompts for local authentication and defaults you want changed. Create a separate application account and grant it only the permissions it needs.
command -v mariadb-secure-installation mysql_secure_installation
On many Debian and Ubuntu installations, local administrative access uses Unix socket authentication, which checks the operating-system account instead of requiring a separate database password. Do not assume the helper will set a root password. Read the prompt and the MariaDB documentation for your installed version.
| What you see | What to check next |
|---|---|
| The mariadb unit is inactive | Read the service status details and MariaDB startup log before changing configuration. |
| Local login is denied | Check which operating-system account runs the client. Socket authentication grants access based on local account permissions. |
| The package version is older than upstream | Compare the distribution’s supported series with the MariaDB repository instructions before changing package sources. |
Remote access requires a dedicated database account, an appropriate listen address and restrictive firewall rules, so keep it disabled unless remote clients are required. When enabling it, follow MariaDB’s remote client access guide for network and privilege changes.
If your next task is deploying a site, our guides to installing WordPress on Debian or Ubuntu and installing Apache on Ubuntu cover adjacent components. Keep database backups as a separate operational task. See our guide to backing up MySQL or MariaDB databases.
Conclusion: Verify MariaDB Before Use
Before connecting the application, make sure the service is running and local access works. Set a backup schedule for your application’s databases, store copies separately from the server, and test a restore before relying on them.
For wider network access, review the site’s Linux firewall and security overview alongside MariaDB’s official documentation.
FAQ
These answers cover version choice and the basic installation check.
How do I check whether MariaDB is installed on Ubuntu?
Use the MariaDB version command to check the installed client package. Check systemctl status mariadb to see whether the server service is running.
Should I use the MariaDB repository or the Ubuntu repository?
Use the Ubuntu or Debian repository for a standard installation. Use MariaDB’s official repository when you specifically need a supported series unavailable in your distribution repository.
