Skip to content

Instantly share code, notes, and snippets.

@lionrajkumar
Last active May 23, 2023 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lionrajkumar/fe01d03a4516a47e2dd119337d8d9037 to your computer and use it in GitHub Desktop.
Save lionrajkumar/fe01d03a4516a47e2dd119337d8d9037 to your computer and use it in GitHub Desktop.
Upgrade MariaDB to latest in Xampp

How to upgrade MySQL to MariaDB in XAMPP in 5 minutes on Windows

Here are the steps I used to to upgrad MySQL to MariaDB in XAMPP on Windows in about 5 minutes. After completing this process, MariaDB will look and work just like MySQL. You may even notice a performance increase in your website. No need to panic fellow developer, increased performance is perfectly normal and just one of the great benefits of MariaDB over MySQL.

IMPORTANT: Before you begin, always be sure to make a good backup. Do not do move instead of copy files in the instructions below as the original files may be required in order to back out and restore the original MySQL environment if it doesn't work out for you.

  1. Open a command prompt.
  2. Go to your xampp folder.
  3. Enter the following command: mysql/bin/mysql --version
  4. Take note of the version of MySQL you have installed. This is the version of MariaDB that you will need. You can now exit the command prompt as the rest of the instructions can be done through Windows Explorer.
  5. Download the ZIP version of MariaDB making sure that the version matches as closely as possible to the version of MySQL you currently have installed.
  6. Shutdown your XAMPP server if it is running.
  7. Rename the xampp/mysql folder to mysql.old.
  8. Unzip the contents of the MariaDB ZIP file into your XAMPP folder.
  9. Rename the MariaDB folder, called something like mariadb-5.5.37-win32, to mysql.
  10. Rename xampp/mysql/data to data.old.
  11. Copy the xampp/mysql.old/data folder (not just the contents) to xampp/mysql/data.
  12. Copy the xampp/mysql.old/backup folder to xampp/mysql/.
  13. Copy the xampp/mysql.old/scripts folder to xampp/mysql/.
  14. Copy mysql_uninstallservice.bat and mysql_installservice.bat from xampp/mysql.old/ into xampp/mysql/.
  15. Copy xampp/mysql.old/bin/my.ini into xampp/mysql/bin.
  16. Edit xampp/mysql/bin/my.ini using a text editor like Notepad. Find skip-federated and add a # in front (to the left) of it to comment out the line if it exists. Save and exit the editor. If you skip this step, MariaDB may not start and you may find an error message similar to the following in the MySQL error log:[ERROR] xampp\mysql\bin\mysqld.exe: unknown option '--skip-federated' [ERROR] Aborting
  17. Start-up XAMPP. If you can't get MariaDB to start, you may need to use the --skip-grant-tables option. I didn't need to do this but am including this tip in case you need it.
  18. Run xampp/mysql/bin/mysql_upgrade.exe. Once you do this, the database may no longer be internally compatible with the MySQL version of your server. If you skip this step, you may notice the following error message in the MySQL error log:[ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2′,'MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323′,'MYSQL40′,'ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2′,'MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323′,'MYSQL40′,'ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
  19. If you see log files like, ib_logfile0 and ib_logfile1, rename or move them to some other folder.
  20. Shutdown and restart MariaDB (MySQL).
  21. Test your website to make sure everything still works. Once you start making changes to it, you will no longer be able to rollback to the MySQL server. MariaDB should now be ready to use. Because it is a drop in replacement for MySQL, you will be able to start and stop it from within the XAMPP Control Panel just like you always have in the past.

If anything goes wrong, and you followed these instructions correctly, you can easily restore the original MySQL by simply shutdown XAMPP and renaming xampp/MySQL to xampp/mariadb and xampp/mysql.old to xampp/mysql to put everything back as it was before.

If you prefer to troubleshoot your issue, you may find more information on the problem by viewing the MySQL error log, either by clicking the Logs button for MySQL in the XAMPP Control Panel, or by opening the following file in a text editor: xampp\mysql\data\mysql_error.log

Ref: Mike's Draft Article Bin

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