🛠️ [GUIDE] How to Set Up a MariaDB Database Server on Ubuntu

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Dear Guest, You are a regular member, and you cannot download files here. To be able to download all files here, you must become a “Lovely Member.” How to become a Lovely Member? Click this link: 💖 How to Become a “Lovely Member” on Our Forum Alternatively, you can upgrade your account to VIP using this link: Upgrade

hrace009

Member
Staff member
Admin
👑 VIP Member
Moderator
Lovely Member
Joined
May 10, 2025
Messages
54
1748766072925.webp


📌 Overview
MariaDB is a powerful, open-source drop-in replacement for MySQL. It’s secure, fast, and widely supported. This guide walks you through installing and configuring MariaDB on a Linux server (Ubuntu/Debian-based).

✅ Requirements​

  • A Linux VPS or Dedicated Server (Ubuntu 20.04 or newer recommended)
  • Root or sudo access
  • Basic knowledge of terminal/SSH

🧱 Step 1: Update Your System​

Bash:
sudo apt update && sudo apt upgrade -y
This ensures all packages are up-to-date before installation.

📥 Step 2: Install MariaDB Server​

Bash:
sudo apt install mariadb-server -y
After installation, MariaDB should start automatically.
To check status:
Bash:
sudo systemctl status mariadb

🔒 Step 3: Secure Your MariaDB Installation​

Run the built-in security script:
Bash:
sudo mysql_secure_installation
Answer the prompts:
  • Set root password: Yes
  • Remove anonymous users: Yes
  • Disallow root login remotely: Yes
  • Remove test database: Yes
  • Reload privileges: Yes

🔧 Step 4: Basic Configuration​

Login to MariaDB shell:
Bash:
sudo mariadb -u root -p
Create a new database and user:
SQL:
CREATE DATABASE hracedb;
CREATE USER 'hraceuser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON hracedb.* TO 'hraceuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

🔁 Step 5: Enable and Start MariaDB​

Ensure MariaDB runs on boot:
Bash:
sudo systemctl enable mariadb
sudo systemctl start mariadb

🌐 Step 6: (Optional) Remote Access Setup​

To allow remote access:
  1. Edit the config:
    Bash:
    sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
  2. Change bind address:
    Code:
    bind-address = 0.0.0.0
  3. Restart mariadb:
    Bash:
    sudo systemctl restart mariadb
  4. Allow port 3306 on your firewall:
    Code:
    sudo ufw allow 3306

🧪 Step 7: Test the Connection​

Use a local or remote MySQL client to test:
Bash:
mysql -u user -p -h <your-server-ip> db

📌 Tips​

  • Use fail2ban or iptables to secure remote access
  • Backup databases regularly with mysqldump
  • Use strong passwords for all DB users


📚 References​



🧩 Need Help?​


Post your issue or configuration snippet at and get help from our community!
 
Back
Top