Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save alfhh/92ae13b2592ac654cfe924319259136f to your computer and use it in GitHub Desktop.
Save alfhh/92ae13b2592ac654cfe924319259136f to your computer and use it in GitHub Desktop.
XAMPP - Replace MariaDB with MySQL

XAMPP - Replace MariaDB with MySQL

Since XAMPP 5.5.30 and 5.6.14, XAMPP ships MariaDB instead of MySQL. MariaDB is not 100% compatible with MySQL and can be replaced with the "orginal" MySQL server.

Backup

  • Backup the old database into a sql dump file
  • Stop the MariaDB service
  • Rename the folder: c:\xampp\mysql to c:\xampp\mariadb

Installation

  • Download MySQL Community Server: https://dev.mysql.com/downloads/mysql/
  • Goto: Other Downloads > ZIP Archive 5.7.19 306.2M (mysql-5.7.19-win32.zip) > No thanks, just start my download.
  • Create a new and empty folder: c:\xampp\mysql
  • Extract mysql-5.7.19-win32.zip to: c:\xampp\mysql
  • Create a new and empty folder: c:\xampp\mysql\data
  • Create a new file: c:\xampp\mysql\bin\my.ini and copy this 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

Initializing the data directory

Initialize a MySQL installation by creating the data directory and populating the tables in the mysql system database.

Open the console (cmd) and enter:

cd c:\xampp\mysql\bin
mysqld --initialize
mysqld --initialize-insecure

The server creates a 'root'@'localhost' and a random password.

Check to make sure that the c:\xampp\mysql\data directory was created. If successful you will find a a [computer name].err file in the data folder with the temporary one time use password for you to login as root for the first time.

Open with Notepad++: c:\xampp\data\[computer name].err

[Note] A temporary password is generated for root@localhost: **************

Copy the password

Start the server

You can use the XAMPP Control Panel (MySQL > Start) to start the MySQL service.

Connect to the server

Open a new console (cmd) window and enter:

cd c:\xampp\mysql\bin
mysql -u root -p

Enter the password you have found in the .err file and press enter.

Now reset the root password to '' (empty).

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '';

Exit the mysql command:

mysql> exit

Restore

Restore the data from the backup file

Finished

Click at the Github ★ Star :-)

Upgrading from an older version (optional)

Repair all corrupted tables:

mysqlcheck.exe -u root -p --auto-repair --all-databases

Update structure to latest version:

mysql_upgrade.exe -u root -p

Tuning my.ini

You can increase the innodb buffer pool size to gain more performance. The sql-mode setting is only necessary for MySQL versions < 5.7.

[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

# Default: 134217728 (128 MB)
# New: 1024 MB
innodb_buffer_pool_size = 1024M

# Default since version 5.7
sql-mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
@JGamboa
Copy link

JGamboa commented Dec 28, 2018

how to repare the data for the phpmyadmin tables?

@Banhack
Copy link

Banhack commented Jan 13, 2020

Good Job!

@engaida
Copy link

engaida commented Jul 1, 2020

جدا شكررررا

@sdkcarlos
Copy link

how to repare the data for the phpmyadmin tables?

You will find the create the create_tables.sql file in the following directory C:\xampp\phpMyAdmin\sql. You can then open PHPMyAdmin and import the file as usual and PHPMyAdmin should work as usual. Step #5 in this article.

@alperendurmus
Copy link

alperendurmus commented Aug 31, 2020

Goto: Other Downloads > ZIP Archive 5.7.19 306.2M (mysql-5.7.19-win32.zip) > No thanks, just start my download.

Updated

@benjaminv
Copy link

What about macOS? Has anyone done that as well? Thanks in advance.

@koihafiz
Copy link

What about macOS? Has anyone done that as well? Thanks in advance.

@PdoubleU
Copy link

Works fine in Windows 10 and XAMPP, thanks!

@maravento
Copy link

Can you post the method for Ubuntu 20.04? thanks

@MegaserverRU
Copy link

Setting environment for using XAMPP for Windows.
Frostik@FROSTIK-ПК d:\xampp

cd d:\xampp\mysql\bin

Frostik@FROSTIK-ПК d:\xampp\mysql\bin

mysql -u root -p !Yr6H6j4H8oP

Enter password: ******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)

Frostik@FROSTIK-ПК d:\xampp\mysql\bin

cd d:\xampp\mysql\bin

Frostik@FROSTIK-ПК d:\xampp\mysql\bin

mysql -u root -p

Enter password: *****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)

Frostik@FROSTIK-ПК d:\xampp\mysql\bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment