Upgrading from version 3.6.8 to version 4

Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Number of replies: 44

Hello there,

I need to upgrade my moodle site from version 3.6.8 to version 4, yes, it is a huge gap. 

My question is, can I jump directly from 3.6.8 to version 4? 

or I should update gradually 3.6 >3.7>3.8>3.9>3.10>3.11>4 ?

I understand that the PHP version has to be set according to the version requirement. Is there anything else I should be looking into before I apply the updates?


Thanks in advance.


Average of ratings: -
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Read - https://docs.moodle.org/dev/Moodle_4.0_release_notes

You should see that 3.6 is fine as a basis for the upgrade and you can go in one step if you want. As both versions of Moodle are compatible with PHP 7.3, that would seem to be a good place to be for the upgrade.

Ideally, copy your site and test the upgrade first. At the very least you should have good backups in case it all goes wrong. 
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

+1 to Howards advice ... in addition ...

get a listing of the plugins you have installed now.  Check Moodle plugins to see if there is a compat version of the plugin for destination version.

Themes are plugins ... when you begin your 'march' or 'hyperjump' (ugh!) might want to set theme to boost as that comes stock with -> 3.6.x.

When it comes to 'hyperjumps' a plan to jump to LTS versions between 3.6.x and destination might be best.

Have we seen 4? or are we just wanting to get to latest and greatest?

Me thinks hops and backups are good strategy ... and as usual, best done with a test clone of current to assure no catch 22's and gotcha's!

When it comes to backups ... code + database at each successful hop and only one moodledata/filedir to begin as most of what is in moodledata is cached and will be rebuilt upon use next hop upwards.

Depending upon time factors and platform and if one can do a test platform setup, might be the perfect time to move acquiring code using git - especially if destination is 4 ... git will allow easy point release updates.

Plus ... consider using scripts provided in code/admin/cli/ for the 'march' including the CLI checks.php script.

'SoS', Ken


In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Thank you, Howard and Ken.

I will look into all the things mentioned above.

@Ken
I have seen 4.
It is not about getting the latest and greatest, I just want to be on 4 and then keep Moodle updated to the latest and stable version. If you think I can do better by avoiding 4 for now and just updating to 3.11 then please advise me on that.

..and please help me know if 3.11 is similar to 3.6.8 visually?
3.6.8 is being used on daily bases and users are quite familiar with it.
If 3.11 is similar in design to 3.6.8, I can upgrade to 3.11 and meanwhile learn the visual changes in 4 and then get to 4 eventually.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

All of series 3.x is very similar ... not much change in look and feel.  Is your site using a 3rd party theme (not boost)?

Version 4 is all about a 'new UI/UX' ...  even advertised as such.

Since you have seen a 4 then what difference would my opinion make?  None! It's your judgement of your students/teachers acceptance of that counts!   Got a sandbox?  Make that one a 4 and invite a couple of your power users in there!

How far you go in your march is totally up to you!

Please see:

https://docs.moodle.org/dev/Releases#Version_support

and note that when 4.1 (next LTS) is released, all other supported versions fall into non-supported (for security fixes - 13 November 2023).

That to say you will be on a 4 before Nov. 2023 ... period.

I would, however, encourage the use of git - regardless of version!

'SoS', Ken


Average of ratings: Useful (2)
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Thank you, Ken.
Your advice has helped me understand the situation better.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
As you've heard from the others a straight upgrade 3.6 > 4.0 is possible. Here is the Moodle march route planer: http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases, where you can also see the evolving system software versions.

About the changes, each version has a release note like https://docs.moodle.org/dev/Moodle_3.7_release_notes. In practice the changes in the no more supported versions do not matter, you have to abandon them anyway. Your alternatives are version 3.9 (LTS), 3.11 and 4.0. Interestingly all the three have the same end-of-life, Nov 2023. See https://moodledev.io/general/releases. So if you want to play it safe, i.e. upset the users least, 3.9 (LTS) is the choice. 3.11 looks graphically very similar so in this respect also safe. 4.0 is a complete graphical redesign. So you definitely want to do a test upgrade and evaluate 4.0 with your users. By the time all these three versions reach EOL, Moodle 4.1 (LTS) is out.

So, the sensible alternatives for the short term are 3.6 > 3.9 (LTS) and 3.6 > 3.11. Then evaluate 4.0 or 4.1 (LTS) or ... for the long term.
Average of ratings: Useful (3)
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Thank you, Visvanath.

Thank you for the advice and links, it really helped.
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -

Hi,

I have decided to go from 3.6>3.9 LTS.

Can you please help me understand which one is the LTS version of Moodle 3.9 (refer to image)? 

Moodle 3.9.17+ (or) Moodle 3.9.17

I think it is 3.9.17+, am I right?

Attachment moodle3.9.png
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

It is the _version_ (3.9) which is LTS. Ref. https://moodledev.io/general/releases#moodle-39-lts. The version 3.9 goes through releases, tagged 3.9.0, 3.9.1, ..., every two months. The ones with a '+' are not formally _released_ (with a tag), they are incrementals between two releases.

If you install a 3.9 today or upgrade to 3.9, you have the choice between 3.9.17 and 3.9.17+. The difference is subtle. Say, if somebody wants to reproduce your exact Moodle to reproduce an issue, then 3.9.17 (without '+') is unambiguous.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi,

Thank you for the reply.

So, I should look for just 3.9
On the official website, 3.8.9 is available but not 3.9

If you do not mind, please can you please share the link for 3.9 LTS.

Thank you.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Tag team ... smile

https://download.moodle.org/releases/security/

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
@Sona, yes you can get the zipped version from the link https://download.moodle.org/releases/security/ or the Git version as described in https://docs.moodle.org/39/en/Git_for_Administrators#Obtaining_the_code_from_Git.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Visvanath,
Thank you for the links.

My question is...is it alright to upgrade from 3.6.8 to 3.9.17( as available on the official site)
OR
3.6.8 to 3.9.0 (available on Git).
https://github.com/moodle/moodle/releases/tag/v3.9.0
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Luis de Vasconcelos -
Yes it is. I went from Moodle 3.5 to 3.9 a while back. Just make sure that the theme you are using in 3.6 has a compatible version for 3.9. The same applies for any other non-core plugins that you are using in 3.5.
Average of ratings: Useful (1)
In reply to Luis de Vasconcelos

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Luis,

Ok, thank you for sharing your experience with 3.5 to 3.9.
The theme is default "boost".
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hallo Sona

You wrote:
> is it alright to upgrade from 3.6.8 to 3.9.17( as available on the official site)

Yes, if you plan to stay with the (basic) zip archive method.

> OR
> 3.6.8 to 3.9.0 (available on Git).

Yes, "OR", because Git is an alternative method to the zip archive. Unlike the zip archive method, the Git method is very versatile. If you 'clone' Moodle Git repository today (there is only one), you can jump between any Moodle release since from 1.3.0 to 4.0.4 in it! I know, it sounds too fantastic. That is how a "proper" https://en.wikipedia.org/wiki/Software_versioning system  works.

Since you want only the current 3.9 (LTS), which is 3.9.17 as of today, you get that as documented in the link I gave earlier in https://moodle.org/mod/forum/discuss.php?d=438365#p1767234.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hello Visvanath,

We can " jump between any Moodle release since from 1.3.0 to 4.0.4 in it! I know, it sounds too fantastic. That is how a "proper" This really sounds fantastic, will definitely look into this.

Thank you for all the valuable information.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

I hate to dampen you anticipations. Yes, Git allows you to jump the code from anywhere to anywhere. But that doesn't mean Moodle instance will follow. For example, Moodle doesn't know what a downgrade is. So jumping back will break Moodle.

I see Ken has posted the initial pointers on the Git path here: https://moodle.org/mod/forum/discuss.php?d=438365#p1767467. Please follow his advice.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Luis de Vasconcelos -
So 3.9.17+ is slightly newer than 3.9.17 and contains small fixes that were added since the 3.9.17 release. Usually you would go with the + version, i.e. 3.9.17+.

https://download.moodle.org/releases/latest/ offers a vague explanation of the differences between the x.xx.x and x.xx.x+ versions:
Moodle 4.0.4+
This package is built every week with new fixes produced by our stable development process. It contains a number of fixes made since the 4.0.4 release and is usually a better choice for production than the actual 4.0.4 package below.

Moodle 4.0.4
This is the latest official update of Moodle 4.0.
Average of ratings: Useful (2)
In reply to Luis de Vasconcelos

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Luis,

Thank you for the information.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

@Sona

In addition ... or just in case ...

Full site backup before you begin.

Check your plugins - especially the additional plugins.   See if all of those have a compatible version for destination version of moodle.

Themes are plugins ... default theme for moodle is usually boost.  If you are using a 3rd party theme site wide, might want to set via config.php the default theme to be boost before you begin your 'march' or 'hyperjumps'.

If you 'march', upgrade to X, then check, then make a backup consisting of code/sqldump and minimal moodledata/filedir/   Don't want to loose ground if the next step in march fails for some reason.

At that version, also check plugins.  Moodle admin check Environment.  Update component.  Check there.   All OK?   Then next step in the 'march'.

It would be wise to clone production to a dev site and do the upgrades there first.

'SoS', Ken


Average of ratings: Useful (2)
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

And 2 more 'sense' if marching and using a dev clone.

Perfect time to get core code under git versioning system and learn how to 'march' via command line git.   Moodle core code provides all the php scripts to accomplish that via command line ... advantages ... takes web service out of the loop ... has fewer moving parts (thus less prone to human error) ... + others.

And, with the additional cli only utility called moosh. for the dev instance, one could also upgrade plugins from moodle.org plugins.

Anyhoo ... thought I'd mention. smile

'SoS', Ken

 

Average of ratings: Useful (2)
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Ken,

Yes, I will be doing a backup of the Moodledata folder, Database and Moodle application installed
Or just take a complete site backup.

It is on default theme, with no additional plugins, checked the Environment( there were a few adjustments to be done- all OK now)
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Does your current code directory have a hidden .git directory as well as a hidden .github directory ... along with related hidden git files: .gitignore and .gitattributes

IF not, you will first have to perform what has been called a 'side load' or a 'direct load' of the above hidden directories/files to use git versioning of core code in your 'upgrade' plan - march or hyperjump.  That will take your site to the highest version of 3.6 - which is 3.6.10.

Use of git to anything higher will get the highest point release of the version you point to using git.

And, so you don't get the wrong impression ... while use of git without -b  does include all branches it doesn't mean that one can use git to upgrade or  'downgrade' (otherwise called 'roll back') a site.  Git used when going from lower version of moodle core code to higher version of moodle core code ... not from higher to lower.

IF an upgrade fails, safest to restore the backup you made prior to upgrade attempt ... at minimum, restore of .sql file to a new database (change to config.php then is required) and restore of code directory.

'SoS', Ken


Average of ratings: Useful (3)
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Ken,

Thank you for the suggestions.
I will keep things safe, always backup then apply an upgrade.
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
@Ken @Visvanath

One final question-

Right now our Moodle is using MySQL.
If I have to update my database,
MySQL or MariaDB?
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Answer question with a question, cause ultimately, you will admin your server! smile

What research have you done already in comparison of MySQL to MariaDB?

Having asked that ... have seen more than one article that mentions MariaDB has better performance (one resource below) ... though I've not found any research article that proves that beyond any doubt. smile [maybe I've not found it!]

https://www.opc-router.com/what-is-mariadb-a-comparison-with-mysql/

Performance

The biggest feature and therefore the biggest advantage of MariaDB is its speed and performance. When it comes to performing queries or replication, MariaDB is faster than MySQL. So if you need a high-performance relational database solution, MariaDB is a good choice. In addition, MariaDB also easily supports a high concurrent number of connections without much performance degradation. So if you have many data sources, this could be another reason to prefer MariaDB over MySQL.

https://mariadb.com/resources/blog/how-to-migrate-from-mysql-to-mariadb-on-linux-in-five-steps/

However ...

https://docs.moodle.org/400/en/Performance_recommendations#Database_performance

Maybe you should install MySQLTuner now and get some reads on what you have. smile

and one more ... for a deeper dive from Percona ...

https://www.percona.com/blog/2017/11/02/mysql-vs-mariadb-reality-check/

So ?????? smile

'SoS', Ken


In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

After re-reading ... 'if I have to update my database' - you mean version of what you are currently running, right?

With what you have to do right now with a 'march' a database change would be in addition to php version and Moodle core code also ... right?

The advice of 'don't change multiples at the same time', to me, has always been good.  If something were to go wrong with your 'march' one might be left wondering what caused.   So you could concentrate on the 'march' and all that is involved with that, and afterwards, if you should see need or decide, switch DB.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Firstly, thank you @Ken @Visvanath @Luis

I was able to upgrade from version 3.6.8 > 3.9.17 > 3.11.10+ successfully.

Regarding the database upgrade-
I just wanted to know which would be preferred for Moodle, MySQL or MariaDB.
Our machine is on MySQL 5.7, when we plan an upgrade to Moodle version 4 or 4.1 we wish to upgrade database aswell. Our options are MySQL 8 or MariaDB 10.2 to 10.6.

If it dosnt really make much of a difference then just upgrade MySQL 5.7 to MySQL 8.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

EoL

MySQL
https://www.mysql.com/support/supportedplatforms/database.html

MariaDB
https://endoflife.date/mariadb

Mr. V's chart:
http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases

that shows ? for both DB - version 4.1 of moodle (next long term support version)

but things change ...

Go to admin - Server - Environment ... update component ... set drop down for
highest version of Moodle in the drop down pick list.

Would think LTS is the goal ... can stay longer at that version ... becomes more stable over time.   IF ... BIG IF ... you keep up-to-date with the point releases.  Comment: am guessing that your hyper jump to current version was done without git. sad

So what did you find in your research of MySQL vs MariaDB?

Uhhh ... why do I get the feeling that 'we' are gonna wait another 4 years to get Moodle version x.x to whatever is latest and greatest [or close] at that time?  

By then ... ????? smile

'SoS', Ken


In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi,
I will answer all that.

Right now I need some help.

DB error-
When I try to Add New User (Manually)
I get the error: Error reading from database. (refer to image)

What I should be checking for? 

please guide me to fix it.
Attachment error DB.png
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Start with disclosing where you ended up with DB - which and version. And did you take it all the way to 4.0.4+?

Did the 'more info' link take you to a page?

Turn on debugging to see if there is more info when attempting add a user manually.

'SoS', Ken

In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Regarding DB- which and version...Mostly I find everyone stating performance of MariaDB is far better than MySQL, It can handle large-sized data easily. Privilege checks are done faster in MariaDB.

The above qualities of MariaDB does sound good for Moodle sites with large Moodle data and Database. But, I would seek an expert's advice on this.

Did I take it to 4.0.4+? not yet. Will definitely share that when I'm there.

I have the same Debug info in this link below
https://moodle.org/mod/forum/discuss.php?d=436890

I will try and apply the solution provided in the above link.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Lots to do when marching a moodle. smile

On this response:
https://moodle.org/mod/forum/discuss.php?d=438365#p1767201

"At that version, also check plugins.  Moodle admin check Environment.  Update component.  Check there.   All OK?   Then next step in the 'march'."

Had you done that, at the bottom of the check, moodle would have warned about not being 'fully compliant with recommended database settings' ... something like that.

Same exact error?  That thread was about upgrading to 4!  IF so, maybe you didn't check Environment, update component and check to see what moodle might be complaining about.

Series 3 of moodle, although not a requirement, highly recommended, some settings
for DB (MySQL or MariaDB):
Barracuda + InnoDB + character set utf8mb4 with collation utf8mb4_unicode_ci.

If you had done the checks you would have seen that at the bottom of the check output.

Barracuda should be default for newer DB version - MySQL or MariaDB.
Character set/collation easily fixed from command line with scripts in code/admin/cli/

At least you've caught it now ... before upgrading to 4.

'SoS', Ken


In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
 Lots to do when marching a moodle.😄 but why?????????? The upgrade should be simple with few things to look for and then you forget and do the actual work that is ...... use Moodle.

"At least you've caught it now ... before upgrading to 4." Yessssss 😄 truly

Moodle admin check Environment.  Update component.  Check there.   All OK?  Yes, it was OK. 
Now, I just see only one check 
php_extension sodium to be installed.

"Had you done that, at the bottom of the check, moodle would have warned about not being 'fully compliant with recommended database settings' ... something like that."  Yes, I did all those changes as suggested. 

Now, I get this debug info- when we try to create a New user(manually)

Debug info: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8' SELECT 'X' FROM smlr_user WHERE LOWER(email) COLLATE utf8mb4_bin = LOWER(?) AND methostid = ? AND id <> ? LIMIT 0, 1 (array ( 0 => 'xxxxk08@gmail.com', 1 => '1', 2 => -1,
Error code: dmlreadexception

I'm not a DB person, guide me if you think I can fix this, or if I should approach a DB expert.


In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Well... I could respond to some of your responses (actually argue that you didn't) ... but I won't.

Anyhoo ...

First, make a backup of your DB.

If you don't suffer from 'clas' (command line avoidance syndrome), you can fix.

ssh into server and ...

In code/admin/cli/

php mysql_collation.php

will bring up a help screen

suggest you do php mysql_collation.php -a

to see the collations needed are available.
Looking for utf8mb4_unicode_ci in that list

IF there, now up arrow
and change the ending of that command to:

php mysql_collation.php --collation=utf8mb4_unicode_ci
See * below ...

Now:

php mysql_compressed_rows.php -i to get info on DB

-f the fix switch *Attempt to fix all tables (requires SUPER privilege)*
Do you know super user crews?

or
-s shows the sql that you could use logging onto the DB using client
and creds (user/password) seen in config.php

* edit config.php at code root file and make this change:
  'dbcollation' => 'utf8mb4_unicode_ci',

 The php sodium ... not installed?

What OS is this?  and do you have root access?

To install php sodium using package manager yum, dnf, or apt-get ... depending on OS.

You  might need to contact hosting provider support for that!

'SoS', Ken


In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Ken,

Thank you so much for the guide.
All good now.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Ken Task -
Picture of Particularly helpful Moodlers

Sorry ... had to comment on this one:

"The upgrade should be simple with few things to look for and then you forget and do the actual work that is ...... use Moodle."

Let's remember you are upgrading from an old un-supported (should have been upgraded already) version of Moodle.  Newer versions of moodle have different requirements (php/extensions/DB/ and so on an so forth) ... so things aren't so simple.

If you have been the admin of this site all along, think when you looked at how to upgrade and what was required, you decided to postpone - for years.   Thus, you are where you are! :|

But ... you've finally decided to upgrade ... good!

Hope there will be some 'take aways' from this experience.

'SoS', Ken


In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
I agree.

I was not the admin for this particular moodle site, recently took over the role. But, this experience has helped me understand how important it is to keep things updated (a huge gap in versions is a real mess).
I will do the updates regularly when it is required.

Thank you once again.
In reply to Ken Task

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
If you suspect a collation error, as explained in the other thread, you should make use of the script admin/cli/mysql_collation.php. Just run it with the php interpreter on the command line and you will get the help screen:

$ php admin/cli/mysql_collation.php
MySQL collation conversions script.
It is strongly recommended to stop the web server before the conversion.
This script may be executed before the main upgrade - 1.9.x data for example.
Options:
--collation=COLLATION Convert MySQL tables to different collation
-l, --list            Show table and column information
-a, --available       Show list of available collations
-h, --help            Print out this help
Example:
$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci

I believe, your original question "MySQL or MariaDB" has been solved. If you have been using MySQL there is no urgent (technical) need to switch to MariaDB. Yes, you need to be careful about the compatible versions. Here is the usual summary: http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases.
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Visvanath,

Thank you so much for the guide and other valuable information.

Yes, MySQL or MariaDB has been solved. As you also mentioned "there is no technical need to switch" I'm sticking to this.
In reply to Sona Kapoor

Re: Upgrading from version 3.6.8 to version 4

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Glad to know.

What are the versions you settled for ultimately: Moodle? PHP? MySQL?

What is your platform? Linux, I suppose, but what is the distribution? Its version/release?
In reply to Visvanath Ratnaweera

Re: Upgrading from version 3.6.8 to version 4

by Sona Kapoor -
Hi Visvanath,

Sorry for the late reply.

As of now, We have settled for:
Moodle version - 3.11.10+
PHP - 7.4
MySQL - 5.7 ( will upgrade to 8 when upgrading to Moodle 4+)

The platform is Linux (AlmaLinux 8.6, will upgrade when required)
Our service provider gave us only 2 options to choose from, CentOS And AlmaLinux.

Once again, thank you all for the support, and for sharing your knowledge and experience.

I will come back when I need guidance/help.