DB

How to Replace MariaDB with MySQL in XAMPP

The installation method of XAMPP was introduced in a previous article:
Set Up PHP Environment on Windows with XAMPP.
Although the XAMPP Control Panel displays “MySQL”, the default database in XAMPP is actually MariaDB.

phpMyAdmin Server Type: MariaDB

Many developers are surprised to learn that the standard DB in XAMPP is MariaDB. XAMPP is a convenient local development environment for PHP developers, but the differences between MariaDB and MySQL can sometimes cause confusion. Therefore, this article explains in detail how to replace the default MariaDB with MySQL in XAMPP.
(The following steps are based on a Windows 11 environment.)

Introduction

With XAMPP, you can easily set up a PHP environment on Windows. However, when using a database, even though “MySQL” is displayed in the XAMPP Control Panel, it’s actually running MariaDB. This is because MariaDB is developed as a fork of MySQL and is mostly compatible with it.
If you wish to use MySQL instead of MariaDB for some reason, you can follow the steps below to make the switch in XAMPP.

Download the Desired MySQL Version

Choose and download the MySQL version and OS you want from the link below:
MySQL :: Download MySQL Community Server (Archived Versions)

Replace the mysql Directory in xampp with the Downloaded MySQL

XAMPP Control Panel image

Stop all actions from the XAMPP Control Panel.

Unzip the downloaded MySQL (e.g. mysql-5.7.38-winx64.zip), resulting in a folder like mysql-5.7.38-winx64, and then rename the existing directory:

Rename C:\xampp\mysql to C:\xampp\mysql_MariaDB.

Then rename the extracted MySQL folder (e.g. mysql-5.7.38-winx64) to mysql and place it under the XAMPP installation directory:
C:\xampp\mysql

Copy MariaDB’s my.ini File

Copy the my.ini file from:
C:\xampp\mysql_MariaDB\bin\my.ini

to:
C:\xampp\mysql\bin\my.ini

Inside the copied my.ini file (around lines 28–36), comment out the following:

#key_buffer=16M

Initialize the Data Directory via Command Prompt

Open Command Prompt, navigate to the mysql directory, and initialize the data directory by running:

cd C:\xampp\mysql
bin\mysqld --initialize-insecure
start /b bin\mysqld
bin\mysql -u root

Create USER and Tables in MySQL

Create a USER in MySQL and set up the tables using the file:
C:/xampp/phpMyAdmin/sql/create_tables.sql

Execute the following MySQL commands in Command Prompt:

CREATE USER pma@localhost;
SOURCE C:/xampp/phpMyAdmin/sql/create_tables.sql;
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER ON phpmyadmin.* TO pma@localhost;
ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '';
ALTER USER pma@localhost IDENTIFIED WITH mysql_native_password BY '';

Launch the XAMPP Control Panel and Confirm Server Type: MySQL

Click the “Admin” button for “MySQL” in the XAMPP Control Panel to launch phpMyAdmin.

Click Admin button for MySQL in XAMPP Control Panel

From the “Database Server” section in phpMyAdmin, if you see “Server Type: MySQL”, then the replacement from MariaDB to MySQL is complete.

Server Type: MySQL in phpMyAdmin

Source: How to Replace MariaDB with MySQL in XAMPP (2)

This guide was referenced from:
How to Replace MariaDB with MySQL in XAMPP (2)

*Please use at your own risk if reusing this content.