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 the old database into a sql dump file
- Stop the MariaDB service
- Rename the folder:
c:\xampp\mysqltoc:\xampp\mariadb
- 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.zipto:c:\xampp\mysql - Create a new and empty folder:
c:\xampp\mysql\data - Create a new file:
c:\xampp\mysql\bin\my.iniand 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/dataInitialize 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-insecureThe 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
You can use the XAMPP Control Panel (MySQL > Start) to start the MySQL service.
Open a new console (cmd) window and enter:
cd c:\xampp\mysql\bin
mysql -u root -pEnter 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> exitRestore the data from the backup file
Click at the Github β Star :-)
Repair all corrupted tables:
mysqlcheck.exe -u root -p --auto-repair --all-databasesUpdate structure to latest version:
mysql_upgrade.exe -u root -pYou 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"
Replace MariaDB with MySQL in XAMPP (Linux)
Open a terminal and dump all your databases:
cd /opt/lampp/bin
./mysqldump -u root -p --all-databases > ~/mariadb_backup.sql
Stop MariaDB:
sudo /opt/lampp/lampp stopmysql
Rename the existing MariaDB folder
cd /opt/lampp
sudo mv mysql mariadb
Download MySQL Community Server (Linux tarball)
Go to MySQL Downloads
.
Choose Linux - Generic (glibc2.17) (x86, 64-bit), tar.gz.
Example filename: mysql-8.0.xx-linux-glibc2.17-x86_64.tar.gz
Download & extract:
cd /opt/lampp
sudo mkdir mysql
cd mysql
sudo tar --strip-components=1 -xvf ~/Downloads/mysql-8.0.*.tar.gz
Create a data directory
cd /opt/lampp/mysql
sudo mkdir data
Create MySQL config file (my.cnf)
Create /opt/lampp/mysql/my.cnf with:
[mysqld]
basedir=/opt/lampp/mysql
datadir=/opt/lampp/mysql/data
socket=/opt/lampp/var/mysql/mysql.sock
pid-file=/opt/lampp/var/mysql/mysql.pid
port=3306
cd /opt/lampp/mysql/bin
sudo ./mysqld --initialize --user=mysql --datadir=/opt/lampp/mysql/data
If you want without root password on first start:
sudo ./mysqld --initialize-insecure --user=mysql --datadir=/opt/lampp/mysql/data
Check /opt/lampp/mysql/data/hostname.err for the generated root password (if not using --insecure).
Edit /opt/lampp/lampp and update any MariaDB-related lines to point to /opt/lampp/mysql/bin/mysqld.
Example snippet:
$mysqlstart="$LAMPP_ROOT/mysql/bin/mysqld_safe --defaults-file=$LAMPP_ROOT/mysql/my.cnf --datadir=$LAMPP_ROOT/mysql/data &"
sudo /opt/lampp/lampp startmysql
Check:
/opt/lampp/mysql/bin/mysql -u root -p
Restore your backup
cd /opt/lampp/bin
./mysql -u root -p < ~/mariadb_backup.sql
Optional tuning
Inside /opt/lampp/mysql/my.cnf you can tweak:
innodb_buffer_pool_size = 1024M
sql-mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
β Done β now your XAMPP on Ubuntu runs MySQL instead of MariaDB.
π Do you want me to also write you a Mac (MAMP/XAMPP) version of this guide, like the one you pasted for Windows?
You said:
fo Mac
ChatGPT said:
Perfect π you want the same process but for macOS (XAMPP / MAMP environment).
Hereβs how to replace MariaDB with the original MySQL on macOS:
π Replace MariaDB with MySQL in XAMPP (macOS)
Open Terminal and dump everything:
cd /Applications/XAMPP/xamppfiles/bin
./mysqldump -u root -p --all-databases > ~/mariadb_backup.sql
Stop MariaDB:
sudo /Applications/XAMPP/xamppfiles/xampp stopmysql
Rename the MariaDB folder
cd /Applications/XAMPP/xamppfiles
sudo mv mysql mariadb
Download MySQL Community Server for macOS
Go to π MySQL Community Downloads
.
Select macOS 13 (x86, 64-bit) or macOS 14 ARM (Apple Silicon) depending on your Mac.
Choose Compressed TAR Archive (not DMG installer), e.g.:
mysql-8.0.xx-macos13-x86_64.tar.gz (Intel Mac)
mysql-8.0.xx-macos14-arm64.tar.gz (Apple Silicon)
Extract into XAMPPβs mysql folder:
cd /Applications/XAMPP/xamppfiles
sudo mkdir mysql
cd mysql
sudo tar --strip-components=1 -xvf ~/Downloads/mysql-8.0.*.tar.gz
Create the data directory
cd /Applications/XAMPP/xamppfiles/mysql
sudo mkdir data
Create MySQL config file (my.cnf)
Make /Applications/XAMPP/xamppfiles/mysql/my.cnf with this content:
[mysqld]
basedir=/Applications/XAMPP/xamppfiles/mysql
datadir=/Applications/XAMPP/xamppfiles/mysql/data
socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
pid-file=/Applications/XAMPP/xamppfiles/var/mysql/mysql.pid
port=3306
Run:
cd /Applications/XAMPP/xamppfiles/mysql/bin
sudo ./mysqld --initialize --user=_mysql --datadir=/Applications/XAMPP/xamppfiles/mysql/data
π If you want no password on first start:
sudo ./mysqld --initialize-insecure --user=_mysql --datadir=/Applications/XAMPP/xamppfiles/mysql/data
After success, check:
ls /Applications/XAMPP/xamppfiles/mysql/data
You should see a hostname.err file β if not, initialization failed.
Edit:
sudo nano /Applications/XAMPP/xamppfiles/xampp
Find the MySQL/MariaDB section and update paths from mariadb to /Applications/XAMPP/xamppfiles/mysql/bin/mysqld_safe.
sudo /Applications/XAMPP/xamppfiles/xampp startmysql
Test connection:
/Applications/XAMPP/xamppfiles/mysql/bin/mysql -u root -p
Restore your databases
cd /Applications/XAMPP/xamppfiles/bin
./mysql -u root -p < ~/mariadb_backup.sql
Optional tuning
In /Applications/XAMPP/xamppfiles/mysql/my.cnf you can optimize:
innodb_buffer_pool_size = 1024M
sql-mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
β Done β now your macOS XAMPP runs real MySQL instead of MariaDB.