Creating a MySQL Installation for Local Testing
This article explains how to install MySQL (via MariaDB) locally in a virtual machine for website testing and development.
Important
These instructions assume you already have a virtual machine running AlmaLinux on your computer.
Installing MySQL (MariaDB)
Hosting.com servers use MariaDB, a drop-in replacement for MySQL.
For compatibility details, see MariaDB vs MySQL Compatibility.
Steps to Install MariaDB:
-
Start the virtual machine.
-
Log in as the root user.
-
Install MariaDB by running:
yum install mariadb-server
-
At the prompt, type
yand press Enter. -
Start the MariaDB service:
systemctl start mariadb
-
Verify that MariaDB is running:
systemctl status mariadb
You should see Active: active (running) in the output.
-
Enable MariaDB to start automatically on boot:
systemctl enable mariadb
-
Secure the installation and set the root password:
mysql_secure_installation
-
Verify that the root password works:
mysql -u root -p
Enter the root password you set. You should see Welcome to the MariaDB monitor.
Tip
After installing MariaDB, you can configure databases, users, and more for local testing.