# Creating a MySQL installation for local testing

> Install MariaDB in a local AlmaLinux virtual machine so you have a MySQL-compatible database for testing your website before going live.

Source: https://helpcenter.ruachost.com/developers/databases/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)

Ruachost servers use MariaDB, a drop-in replacement for MySQL.

For compatibility details, see [MariaDB vs MySQL Compatibility](https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility).

## Steps to Install MariaDB

1. Start the virtual machine.
2. Log in as the root user.
3. Install MariaDB by running:

```
yum install mariadb-server
```

4. At the prompt, type `y` and press Enter.
5. Start the MariaDB service:

```
systemctl start mariadb
```

6. Verify that MariaDB is running:

```
systemctl status mariadb
```

You should see `Active: active (running)` in the output.

7. Enable MariaDB to start automatically on boot:

```
systemctl enable mariadb
```

8. Secure the installation and set the root password:

```
mysql_secure_installation
```

9. 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.
