How to Replace MariaDB with MySQL in XAMPP?

You can easily replace MariaDB with MySQL in XAMPP with the help of this tutorial.

Last Updated on by Azib Yaqoob

New XAMPP comes with MariaDB in place of MySQL. However, if you prefer MySQL over MariaDB, I will show you how to replace MariaDB with MySQL in XAMPP.

Please follow these instructions to change MariaDB to MySQL in XAMPP:

Note: This method has been tested for Windows 10 and 11.

Backup SQL & Stop MariaDB

  • Backup your old database into an SQL dump file.
mariadb-dump -u admin_backup -p -x -A > /data/backup/dbs.sql
  • Stop the MariaDB service.

Download & Install MySQL

  • Rename the folder c:\xampp\mysql to c:\xampp\mariadb.
  • Download MySQL Community Server.
MySQL Download MySQL download
  • Create a new and empty folder: c:\xampp\mysql.
  • Extract the downloaded ZIP file into c:\xampp\mysql.
  • Create a new and empty folder: c:\xampp\mysql\data.
  • Create a new file: c:\xampp\mysql\bin\my.ini and add the following content:
[mysqld]
# set basedir to your installation path
basedir=c:/xampp/mysql
# set datadir to the location of your data directory
datadir=c:/xampp/mysql/data

Initialize MySQL

  • Initialize a MySQL installation and enter the following code:
cd c:\xampp\mysql\bin
mysqld --initialize
mysqld --initialize-insecure

Find Root Password

MySQL server creates a ‘root’@localhost’ and a random password.

First, you need to check that the c:\xampp\mysql\data directory was created.

Suppose you find a [computer name].err file in the data folder with the temporary one-time use password for you to log in as root.

open the c:\xampp\data[computer name].err file with any text editor. Copy the password.

Start & Connect the Server

Use the XAMPP Control Panel to start the MySQL service.

  • Open a new CMD Console and change the directory to ‘c:\xampp\mysql\bin’.
  • Connect to MySQL and enter the password you found in the ‘.err’ file:
cd c:\xampp\mysql\bin
mysql -u root -p
  • Reset the root password to an empty string:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '';
  • Exit the MySQL command prompt:
mysql> exit

In this tutorial, we’ve covered the essential steps to replace MariaDB with MySQL in XAMPP.

By following these steps, you’ve ensured a smooth transition while keeping your data and configurations.

Remember to create backups at crucial stages and exercise caution throughout the process. Enjoy working with your new MySQL-powered local development environment!

Azib Yaqoob
Azib Yaqoob

Azib is dedicated to making website management easy for beginners. On his blog, he shares straightforward tips and tricks to help you master WordPress. From learning the basics to boosting your site's visibility with SEO, Azib's got you covered. Ready to take your website to the next level? Contact Azib today and start optimizing your WordPress journey!

Articles: 94

One comment

  1. flowwing step myphpAdmin die!!!

    MySQL said: Documentation

    Cannot connect: invalid settings.
    mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
    mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
    Connection for controluser as defined in your configuration failed.
    mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
    mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
    phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server

Leave a Reply

Your email address will not be published. Required fields are marked *