How to create a MySQL installation for local testing

This article describes how to create a MySQL installation that you can use for local testing.

The following procedures assume that you have already created a virtual machine running AlmaLinux on your local computer. For information about how to do this, please see this article.

Table of Contents

Installing MySQL

A2 Hosting servers actually use MariaDB, an enhanced drop-in replacement for MySQL.

For detailed information about compatibility between MariaDB and MySQL, please visit https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility.

To install MariaDB on your virtual machine, follow these steps:

  1. Start the virtual machine, if you haven't already.
  2. Log in to the virtual machine as the root user.
  3. At the command prompt, type the following command to install MariaDB:
    yum install mariadb-server
    
  4. At the Is this ok prompt, type y and then press Enter. The installation process begins.
  5. After installation completes, type the following command to start MariaDB:

    systemctl start mariadb
  6. To confirm MariaDB is running, type the following command:

    systemctl status mariadb

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

  7. To make MariaDB start automatically on system boot, type the following command:

    systemctl enable mariadb
  8. To secure the installation, type the following command:

    mysql_secure_installation

    This program enables you to set the root MySQL password and other security-related settings.

  9. To make sure the root password was set correctly, type the following command:

    mysql -u root -p
  10. Type the root password that you set in step 8, and then press Enter. You should see Welcome to the MariaDB monitor in the output.

    Now that you have installed MariaDB, you are ready to configure it. For information about how to set up MySQL databases, users, and more, please see the Related Articles section below.
Get MySQL Hosting

Article Details

  • Level: Advanced

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.