Skip to content

Instantly share code, notes, and snippets.

@meorajrul
Last active November 11, 2024 12:39
Show Gist options
  • Save meorajrul/b57803bf1b4ddfd2f93e6ad37c3ac5f2 to your computer and use it in GitHub Desktop.
Save meorajrul/b57803bf1b4ddfd2f93e6ad37c3ac5f2 to your computer and use it in GitHub Desktop.
Laragon Multiple MySQL Database Version Setup

Pre-requisite

  1. Laragon
  2. Multiple DB are ready to install (look table below)
  3. Unzip tools like 7zip or Winrar
  4. Laragon installation path default is C:\laragon\, might be different depending on where you install this. However we will focus on laragon mysql directory folder which located on C:\laragon\bin\mysql

If you look at Laragon documentation on multiple DB it should be straight forward however i would like to make it as painless as possible with the setup

By default Laragon (Full version) comes with MySQL 8.0.* version. However we will install latest or older version of MySQL show how we switch to one another using Laragon system tray mysql version switch feature.

2

For this context we will use MySQL community ZIP version that does not have any debugging binary and test suite (keep the size down)

MySQL Version Download Path Local Data Path
5.7.44 Link C:\laragon\data\mysql
8.0.* (Default) N/A C:\laragon\data\mysql-8
8.4 LTS Link C:\laragon\data\mysql-8.4

Steps for MySQL 8.4

  1. Download and unzip the file to C:\laragon\bin\mysql. Your folder structure should look like this after extract. image
  2. Open command line using CMDer (default terminal by Laragon) and run:
cd C:\laragon\bin\mysql\mysql-8.4.0-winx64\bin
mysqld --initialize --datadir="C:\laragon\data\mysql-8.4" --basedir="C:\laragon\bin\mysql\mysql-8.4.0-winx64" --console

2-mysql init

Make sure to store those password generated in the terminal for later use. We will use it to reset root password when we start to login via HeidiSQL

  1. Copy my.ini (mysqld config) below to mysql 8.4 base folder and set it as read-only (to avoid Laragon override setting using old template)

3-1

  1. Right click on Laragon Tray and switch to MySQL 8.4 version

2-1

  1. Start services

4 5-laragon-started

  1. Open HeidiSQL or any of your DB IDEs and start accessing the table. After first login with root username and generated password, HeidiSQL will ask for new password. Key-in your desirable new password and your are done.

6-mysql password reset

[client]
#password=your_password
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket=/tmp/mysql.sock
key_buffer_size=256M
max_allowed_packet=512M
table_open_cache=256
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=4M
myisam_sort_buffer_size=64M
thread_cache_size=8
secure-file-priv=""
explicit_defaults_for_timestamp=1
datadir= "C:/laragon/data/mysql-8.4"
basedir= "C:/laragon/bin/mysql/mysql-8.4.0-winx64"
#default_authentication_plugin=mysql_native_password
[mysqldump]
quick
max_allowed_packet=512M
@falansari
Copy link

MySQL v8.4 works great with @FlavioSuarez 's instructions (thanks!). I'm trying to install older version however, v5.5.32 in my case (for client project) but I tried it with 5.7 and many others, anything below 8 gives me the same error when trying to initialize and never works. Could anyone help me please? This is the log:

240625 17:56:49 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
240625 17:56:49 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
240625 17:56:49 InnoDB: The InnoDB memory heap is disabled
240625 17:56:49 InnoDB: Mutexes and rw_locks use Windows interlocked functions
240625 17:56:49 InnoDB: Compressed tables use zlib 1.2.3
240625 17:56:49 InnoDB: Initializing buffer pool, size = 128.0M
240625 17:56:49 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
240625 17:56:49 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
240625 17:56:49 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
240625 17:56:49 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
240625 17:56:49 InnoDB: Waiting for the background threads to start
240625 17:56:50 InnoDB: 5.5.32 started; log sequence number 0
240625 17:56:50 [ERROR] mysqld: unknown option '--initialize'
240625 17:56:50 [ERROR] Aborting

240625 17:56:50 InnoDB: Starting shutdown...
240625 17:56:50 InnoDB: Shutdown completed; log sequence number 1595675
240625 17:56:50 [Note] mysqld: Shutdown complete

@falansari
Copy link

Ok, after much trial and error I finally got it to work. I'll post the steps that worked in case anybody else is having the same issues:

  1. In my.ini, comment out the explicit_defaults_for_timestamps and authentication lines:

`[client]
#password=your_password
port=3306
socket=/tmp/mysql.sock

[mysqld]
port=3306
socket=/tmp/mysql.sock
key_buffer_size=256M
max_allowed_packet=512M
table_open_cache=256
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=4M
myisam_sort_buffer_size=64M
thread_cache_size=8

secure-file-priv=""
#explicit_defaults_for_timestamp=1
datadir= "D:/Apps/laragon/data/mysql-5.5"
basedir= "D:/Apps/laragon/bin/mysql/mysql-5.5.32-winx64"
#default_authentication_plugin=mysql_native_password
#mysql_native_password=ON

[mysqldump]
quick
max_allowed_packet=512M`

  1. From the mysql-5.x.-winx64 folder (whichever version you downloaded from ZIP file), copy the data folder and paste it in the laragon data directory (laragon/data/mysql or laragon/data/mysql-5.x if you wish to use a separate directory)
  2. Then in the CMDer terminal, following the mysqld initialization command, remove --initialize from the command:
    mysqld --datadir="C:\laragon\data\mysql-5.5" --basedir="C:\laragon\bin\mysql\mysql-5.5.32-winx64" --console
  3. Login without password.

This should work.

@IlhamGhaza
Copy link

Solved the problem by simply

  • opening the my.ini file on the 8.4 folder
  • commenting the line "default_authentication_plugin=mysql_native_password"
  • setting a new line "mysql_native_password=ON" (the MySQL 8.4 way to setting this)
  • saving the my.ini file
  • setting the my.ini file as read-only, so Laragon don't change it
  • start all
  • use HeidiSQL as before

Hope this help!

thank you. it`s work

@Nightprince
Copy link

Thanks, Work for MySQL 9.0.1

@dhanyn10singapay
Copy link

Solved the problem by simply

  • opening the my.ini file on the 8.4 folder
  • commenting the line "default_authentication_plugin=mysql_native_password"
  • setting a new line "mysql_native_password=ON" (the MySQL 8.4 way to setting this)
  • saving the my.ini file
  • setting the my.ini file as read-only, so Laragon don't change it
  • start all
  • use HeidiSQL as before

Hope this help!

thanks, this is works

@FlavioSuarez
Copy link

Warning!!
Your MySQL 8 databases will be converted to 8.4 version!
If you want to keep your 8.0 data, make a copy of the folder C:\laragon6\data\mysql-8 to something like C:\laragon6\data\mysql-80 and set the .ini file accordingly...

@khangphung-vl
Copy link

khangphung-vl commented Aug 21, 2024

$ mysqld --initialize --datadir="C:\laragon\data\mysql-8.4" --basedir="C:\laragon\bin\mysq
l\mysql-8.4.2-winx64" --console
2024-08-21T02:37:49.447022Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-08-21T02:37:49.451483Z 0 [System] [MY-013169] [Server] C:\laragon\bin\mysql\mysql-8.4.2-winx64\bin\mysqld.exe (mysqld 8.4.2) initializing of server in progress as process 2948
2024-08-21T02:37:49.502378Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-08-21T02:37:49.705350Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-08-21T02:37:51.081065Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default_authentication_plugin=mysql_native_password'.
2024-08-21T02:37:51.082245Z 0 [ERROR] [MY-013455] [Server] The newly created data directory C:\laragon\data\mysql-8.4\ by --initialize is unusable. You can remove it.
2024-08-21T02:37:51.083019Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-08-21T02:37:52.452060Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

SOLUTION: https://chatgpt.com/share/b68d706c-b7a2-4ffe-b387-dea2dd30d4a1
I didn't expect this error since people in this discussion made the upgrade seamlessly. The my.ini file should be update before the initialization, I guess, can you consider moving that step forward? Or does it need to remove the my.ini file (if exists before running the initialization) ?. @meorajrul

@meorajrul
Copy link
Author

$ mysqld --initialize --datadir="C:\laragon\data\mysql-8.4" --basedir="C:\laragon\bin\mysq
l\mysql-8.4.2-winx64" --console
2024-08-21T02:37:49.447022Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-08-21T02:37:49.451483Z 0 [System] [MY-013169] [Server] C:\laragon\bin\mysql\mysql-8.4.2-winx64\bin\mysqld.exe (mysqld 8.4.2) initializing of server in progress as process 2948
2024-08-21T02:37:49.502378Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-08-21T02:37:49.705350Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-08-21T02:37:51.081065Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default_authentication_plugin=mysql_native_password'.
2024-08-21T02:37:51.082245Z 0 [ERROR] [MY-013455] [Server] The newly created data directory C:\laragon\data\mysql-8.4\ by --initialize is unusable. You can remove it.
2024-08-21T02:37:51.083019Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-08-21T02:37:52.452060Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

SOLUTION: https://chatgpt.com/share/b68d706c-b7a2-4ffe-b387-dea2dd30d4a1 I didn't expect this error since people in this discussion made the upgrade seamlessly. The my.ini file should be update before the initialization, I guess, can you consider moving that step forward? Or does it need to remove the my.ini file (if exists before running the initialization) ?. @meorajrul

The reason why my.ini files on the next step after initialization is because the new mysql folder version are not created yet hence i have included a copy of my.ini files below (or you can edit and comment out "default_authentication_plugin") and you have to set the file to read-only.

side note, latest version of laragon 6 and above solve this installation issue hack

@mamlzy
Copy link

mamlzy commented Sep 4, 2024

Thanks, Work for MySQL 9.0.1

@Nightprince can you help me why i can't initialize?

image

@mamlzy
Copy link

mamlzy commented Sep 4, 2024

Nevermind, now my MySQL 9.0.1 successfully installed

@serdarhocam
Copy link

Thank you so much! ( Çok teşekkür ederim :) ! )

Warning!! Your MySQL 8 databases will be converted to 8.4 version! If you want to keep your 8.0 data, make a copy of the folder C:\laragon6\data\mysql-8 to something like C:\laragon6\data\mysql-80 and set the .ini file accordingly...

Solved the problem by simply

  • opening the my.ini file on the 8.4 folder
  • commenting the line "default_authentication_plugin=mysql_native_password"
  • setting a new line "mysql_native_password=ON" (the MySQL 8.4 way to setting this)
  • saving the my.ini file
  • setting the my.ini file as read-only, so Laragon don't change it
  • start all
  • use HeidiSQL as before

Hope this help!

@JustCLE4R
Copy link

Warning!! Your MySQL 8 databases will be converted to 8.4 version! If you want to keep your 8.0 data, make a copy of the folder C:\laragon6\data\mysql-8 to something like C:\laragon6\data\mysql-80 and set the .ini file accordingly...

Solved the problem by simply

  • opening the my.ini file on the 8.4 folder
  • commenting the line "default_authentication_plugin=mysql_native_password"
  • setting a new line "mysql_native_password=ON" (the MySQL 8.4 way to setting this)
  • saving the my.ini file
  • setting the my.ini file as read-only, so Laragon don't change it
  • start all
  • use HeidiSQL as before

Hope this help!

Its work on my machine, thank you very much!

@bencote2020
Copy link

Thank you JustCLE4R for your super easy fix to updating to MySQL 8.4.2. I was wondering if you have a step by step process to update Laragon to MySQL 9.0?

@imAjaypal
Copy link

One and only simple solution for above is:
JUST use Laragon terminal for this command: mysqld --datadir="C:\laragon\data\mysql-5.5" --basedir="C:\laragon\bin\mysql\mysql-5.5.32-winx64" --console

@suwantara
Copy link

Warning!! Your MySQL 8 databases will be converted to 8.4 version! If you want to keep your 8.0 data, make a copy of the folder C:\laragon6\data\mysql-8 to something like C:\laragon6\data\mysql-80 and set the .ini file accordingly...

Solved the problem by simply

  • opening the my.ini file on the 8.4 folder
  • commenting the line "default_authentication_plugin=mysql_native_password"
  • setting a new line "mysql_native_password=ON" (the MySQL 8.4 way to setting this)
  • saving the my.ini file
  • setting the my.ini file as read-only, so Laragon don't change it
  • start all
  • use HeidiSQL as before

Hope this help!

Screenshot 2024-11-10 130809

I found the error like continuously, is there any other solution? my.ini file already says setting to read-only

@FlavioSuarez
Copy link

Hi,

You must set where are your data.
Include a line in your my.ini file, with something like this:

datadir= "C:/laragon6/data/mysql-8.4.3"

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