How To Install MariaDB On Ubuntu VPS Server
MariaDB is one of the most popular open-source relational database systems used for:
- websites
- WordPress hosting
- SaaS applications
- APIs
- CRM systems
- enterprise applications
It is a powerful alternative to MySQL and is widely used in Linux VPS hosting environments.
In this guide,
you will learn how to install MariaDB on an Ubuntu VPS server step-by-step.
What Is MariaDB?
MariaDB is a relational database management system developed as a fork of MySQL.
It provides:
- high performance
- scalability
- compatibility
- open-source flexibility
- enterprise reliability
MariaDB is commonly used with:
- PHP
- WordPress
- Laravel
- WHMCS
- Node.js
- business applications
Why Use MariaDB?
MariaDB is popular because it offers:
- fast database performance
- strong MySQL compatibility
- active development
- scalability
- enterprise-grade reliability
- open-source infrastructure
Many Linux hosting providers prefer MariaDB for VPS hosting environments.
Prerequisites
Before starting,
ensure you have:
- Ubuntu VPS server
- root or sudo access
- SSH access enabled
Recommended operating system:
Ubuntu 22.04 LTS
Step 1 — Connect To Your VPS Server
Connect to your VPS using SSH.
Command:
ssh root@your-server-ip
Example:
ssh root@192.168.1.10
Step 2 — Update Server Packages
Update existing packages.
Command:
apt update && apt upgrade -y
This improves:
- security
- compatibility
- system stability
Step 3 — Install MariaDB Server
Install MariaDB package.
Command:
apt install mariadb-server -y
MariaDB packages will install automatically.
Step 4 — Start MariaDB Service
Start MariaDB service.
Command:
systemctl start mariadb
Enable automatic startup on boot.
Command:
systemctl enable mariadb
Step 5 — Verify MariaDB Status
Check if MariaDB is running correctly.
Command:
systemctl status mariadb
If successful,
you should see:
active (running)
Step 6 — Secure MariaDB Installation
Run MariaDB security script.
Command:
mysql_secure_installation
This helps:
- remove anonymous users
- disable remote root login
- remove test databases
- improve database security
Step 7 — Login To MariaDB
Access MariaDB terminal.
Command:
mysql -u root -p
Enter your MariaDB root password.
Step 8 — Create A New Database
Create a database.
Command:
CREATE DATABASE mydatabase;
Step 9 — Create Database User
Create a new user.
Command:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'StrongPassword';
Step 10 — Grant Database Permissions
Grant privileges to the user.
Command:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
Reload privileges.
Command:
FLUSH PRIVILEGES;
Step 11 — Exit MariaDB Terminal
Exit database shell.
Command:
EXIT;
Important MariaDB Commands
Start MariaDB
systemctl start mariadb
Stop MariaDB
systemctl stop mariadb
Restart MariaDB
systemctl restart mariadb
Check MariaDB Status
systemctl status mariadb
MariaDB Configuration File
Main MariaDB configuration file:
/etc/mysql/mariadb.conf.d/50-server.cnf
How To Enable Remote MariaDB Access
Edit configuration file.
Command:
nano /etc/mysql/mariadb.conf.d/50-server.cnf
Find:
bind-address = 127.0.0.1
Change to:
bind-address = 0.0.0.0
Restart MariaDB.
Command:
systemctl restart mariadb
Configure Firewall For MariaDB
Allow MariaDB port.
Command:
ufw allow 3306/tcp
Reload firewall.
Command:
ufw reload
Common MariaDB Errors
Access Denied Error
Possible causes:
- incorrect password
- invalid user permissions
- authentication configuration issues
MariaDB Service Not Starting
Check logs.
Command:
journalctl -xe
Port 3306 Already In Use
Check active services.
Command:
netstat -tulpn | grep 3306
MariaDB vs MySQL
MariaDB provides:
- better open-source flexibility
- active community development
- strong compatibility with MySQL
- excellent performance
It is widely used as a MySQL replacement.
Why Businesses Use MariaDB
Businesses use MariaDB because it offers:
- scalable database infrastructure
- enterprise reliability
- strong performance
- open-source flexibility
- excellent Linux compatibility
It powers:
- websites
- SaaS platforms
- enterprise systems
- hosting environments
Why Choose DJ Technologies VPS Hosting
DJ Technologies Linux VPS hosting provides:
- NVMe SSD infrastructure
- enterprise virtualization
- premium low latency network
- scalable cloud resources
- optimized database environments
- advanced infrastructure security
- high performance VPS hosting
- 24×7 technical support
Our VPS infrastructure is optimized for:
- MariaDB hosting
- database servers
- SaaS applications
- business platforms
- scalable cloud workloads
Final Thoughts
MariaDB is one of the best database systems for Linux VPS hosting environments.
Its:
- scalability
- compatibility
- performance
- enterprise reliability
make it ideal for:
- websites
- business applications
- WordPress hosting
- SaaS platforms
- enterprise infrastructure.
Persian