To install MariaDB on Debian 13 (Trixie), follow these steps (same rhythm as my Debian 12 guide, but updated for Debian 13).

Debian 13’s repo package is currently mariadb-server (1:11.8.3-0+deb13u1). (Debian Packages)

1. Update Package Index

Start by updating the package index to ensure your system has the latest information on available packages.

sudo apt update

(Optional but recommended)

sudo apt -y upgrade
sudo reboot

2. Install MariaDB Server

Use the following command to install the MariaDB server and client:

sudo apt install mariadb-server mariadb-client -y

3. Start and Enable MariaDB Service

Once installed, start the MariaDB service and enable it to start on boot.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Check status:

sudo systemctl status mariadb --no-pager

4. Secure the Installation (force root password)

To improve the security of your MariaDB server, run the security script:

sudo mariadb-secure-installation
# legacy name (still common in tutorials)
sudo mysql_secure_installation

MariaDB notes that from 10.4+, unix_socket auth is commonly applied by default, so many older tutorials are outdated. In our case, we want root password, so pay attention to the prompt. (MariaDB)

During this process, you’ll be asked to:

  1. Set a root password.
  2. Remove anonymous users.
  3. Disallow root login remotely.
  4. Remove test databases.
  5. Reload privilege tables.

Important (Debian 13 / modern MariaDB prompt):
If you see:

  • Switch to unix_socket authentication [Y/n]

Answer n (NO), because you want password-based root login. (MariaDB)

Then when asked to set root password, answer Y and set a strong password.

5. Test Root Login (Password)

Verify you can login using root + password:

mariadb -u root -p

If root is already using unix_socket (fix it)

If you accidentally selected unix_socket, you can switch root back to password auth.

Login locally (this still works if socket auth is enabled):

sudo mariadb

Then run:

ALTER USER 'root'@'localhost'
  IDENTIFIED BY 'YOUR_STRONG_PASSWORD';
FLUSH PRIVILEGES;

Modern MariaDB root defaults can involve socket authentication, but ALTER USER is the supported way to change credentials/auth behavior. (MariaDB)

Exit:

exit;

Test again:

mariadb -u root -p

6. (Optional) Configure MariaDB

You can edit the MariaDB configuration file for additional settings if needed. The main configuration file is located at:

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

After making changes, restart MariaDB to apply them:

sudo systemctl restart mariadb

Your MariaDB server should now be up and running on Debian 13.

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.