Installing MariaDB on Ubuntu Systems

MariaDB Installation Process

Execute the following command to install both server and client components:

sudo apt-get install mariadb-server mariadb-client

Verifying Installation Status

Checking Version

mysql --version

Example output:

mysql Ver 15.1 Distrib 10.1.29-MariaDB, for debian-linux-gnu (x86_64)

Checking Service Status

sudo service mysql status

Typical output:

● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled)
   Active: active (running) since Sat 2018-08-04 18:53:56 CST

Service Maangement Commands

Use any of these equivalent command sets:

# Using mysql service name
sudo service mysql start
sudo service mysql stop
sudo service mysql restart

# Using mariadb service name
sudo service mariadb start
sudo service mariadb stop
sudo service mariadb restart

# Using mariadb-server service name
sudo service mariadb-server start
sudo service mariadb-server stop
sudo service mariadb-server restart

Database Connection

mysql -u root

Successful connection output:

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.29-MariaDB-6 Ubuntu 18.04

Connection Issues

Common socket error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

Verify service status and ensure proper startup. If timeout occurs:

Job for mariadb.service failed because a timeout was exceeded

Port Configuration

Edit the server configuration file:

# For Debian/Ubuntu systems
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

Tags: MariaDB Ubuntu Linux Database Administration MySQL

Posted on Sun, 17 May 2026 05:44:59 +0000 by TheFilmGod