How to Set Up MariaDB on a VPS: Installation and Initial Configuration Updated on April 9, 2026 by Sam Page 1 Minutes, 40 Seconds to Read MariaDB has become the go-to MySQL-compatible database for many developers and system administrators. As a true open-source fork of MySQL with active development and performance improvements, it’s an excellent choice for WordPress sites, web applications, and data-driven projects. Why Mariadb? MariaDB maintains binary drop-in compatibility with MySQL, meaning most applications work without modification. It also ships with features like Aria storage engine for crash recovery, thread pool for better concurrency, and Galera Cluster for multi-master replication. Installing Mariadb On Ubuntu/Debian: sudo apt update sudo apt install mariadb-server -y sudo systemctl start mariadb sudo systemctl enable mariadb On AlmaLinux/RHEL: sudo dnf install mariadb-server -y sudo systemctl start mariadb sudo systemctl enable mariadb Securing Mariadb After installation, run the security script: sudo mariadb-secure-installation You’ll be prompted to:• Set root password• Remove anonymous users• Disallow root login remotely• Remove test database• Reload privilege tables Initial Configuration Edit the configuration file to optimize performance:/etc/mysql/mariadb.conf.d/50-server.cnf (Ubuntu)/etc/my.cnf.d/server.cnf (AlmaLinux) Key settings:innodb_buffer_pool_size = 2G # 50-70% of RAMmax_connections = 150slow_query_log = 1slow_query_log_file = /var/log/mysql/slow-query.loglong_query_time = 2 Creating Databases And Users Log into MariaDB: sudo mariadb -u root -p Create database: CREATE DATABASE myapp_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; Create user and grant privileges: CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'secure_password'; GRANT ALL PRIVILEGES ON myapp_db.* TO 'appuser'@'localhost'; FLUSH PRIVILEGES; ENABLING REMOTE ACCESS (Optional) Edit configuration and change bind-address to 0.0.0.0Configure firewall to allow port 3306Restart MariaDB Setting Up Automated Backups Create backup script at /usr/local/bin/mariadb-backup.sh: #!/bin/bash BACKUP_DIR="/var/backups/mariadb" DATE=$(date +%Y%m%d) mysqldump -u root -p'password' --all-databases | gzip > $BACKUP_DIR/backup_$DATE.sql.gz find $BACKUP_DIR -mtime +7 -delete Schedule with cron for daily 2 AM backups: 0 2 * * * /usr/local/bin/mariadb-backup.sh Need managed MariaDB hosting? InMotion Hosting VPS plans include root access for MariaDB installation, and our managed VPS tier includes database optimization and monitoring as part of Launch Assist. Share this Article Related Articles How to Set Up MariaDB on a VPS: Installation and Initial Configuration How to List Accounts in your cPanel Server Getting Started with Managed VPS Hosting DNSSEC in cPanel Managed Servers for Better Security Securing Your VPS: 24 Ways to Harden Server Creating New Users in CentOS 7 Upgrade to VPS NVMe SSD Hosting How to Install Java on CentOS Check Your Server Information on a VPS or Dedicated Hosting account Getting Started With the ImunifyAV cPanel Plugin