Issue with migrating MySQL data from Elgg 2.x to MariaDB on Elgg 3.x

I used composer to install Elgg current version (3.3.16) on a machine running CentOS 8, PHP 7.2.4, Apache 2.4, and MariaDB 10.3. Then I imported MySQL data from Elgg 2.x production to newly created database. When I tried to migrate Elgg 2.x database by hitting a browser with 'https://mysite/upgrade.php, I got the 'The site secret is not set.' error. Next, I looked up the Elgg documentations and found these two discussions below:

https://github.com/Elgg/Elgg/issues/12126

https://elgg.org/discussion/view/1455994/alternative-dbmss

After reading these two discussion, I am still puzzled whether MariaDB is now working on Elgg 3 or not.

Answers / clarification / suggestion will be greatly appreciated.

Thanks!

 

  • Wanted to clarify my last statement a little bit. 

    I know Elgg 3 is working with fresh MariaDB. My issue is when I migrated existing MySQL data to MariaDB.

  • I think your issue has more to do with the migration from 2.3 to 3.3 than with the switch of the DB.

    The 2.3 site was working? Maybe just to be sure you could regen the site secret on 2.3 before trying the upgrade again?

    PS: MariaDB isn't officially supported. Yes it can work, I've had it working with a customer. But certain plugins did have a different outcome on MySQL vs MariaDB. Please keep it in mind.

  • Thanks Jerome!

    My 2.3 site is working fine. I successfully migrated MySQL data from Elgg 2.3 to MySQL database on Elgg 3.x without regenerating the site secret. 

    It's good to know that certain plugins have different results on MySQL vs MariaDB.

    Thanks again!

  • @seri_ng 

    We've successfully migrated to MariaDB for a long time without any problems.

    We currently have several sites on both Elgg 2 and Elgg 3 running on MariaDB.

  • Thanks Nikolai!

    Did you migrate existing MySQL data from Elgg 2.x to MariaDB on Elgg 3.x? If so, I really have no ideas what I did wrong with my DB migration.

    After I imported Elgg 2.x database to my Elgg 3.x site, I hit a browser with https://sitename/upgrade.php which it should automatically run the migration. Did I miss something major?

    Thanks!

  • Did you migrate existing MySQL data from Elgg 2.x to MariaDB on Elgg 3.x?

    Right.

    Did I miss something major?

    Maybe this.

    1 - Change Database default collation as utf8mb4.

    2 - Change table collation as CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci.

    From our my.cnf :

    [client]
    default-character-set = utf8mb4
    [mysqld]
    character-set-server = utf8mb4
    collation-server = utf8mb4_unicode_ci
    character-set-client-handshake = FALSE
    [mysql]
    default-character-set = utf8mb4
  • @Nikolai. Really appreciate your help and the snippet of my.cnf configs. I'll try this and update the discussion whether my migration works or not.

    Cheers!

  • This is good to know. This very helpful discussion is much appreciated.

  • I finally got the DB migration from Elgg 2.x (MySQL) to Elgg 3.x (MariaDB) working. I must admit that it's a bit hacky approach. Below were steps I took to accomplish it:

    1. Install Elgg 3.3.16 using composer and vendor/bin/elgg-cli install

    2. Get the site secret from my Elgg 2.x DB

    3. Add the $CONFIG->__site_secret__ = 'site secret from step 2'; to the elgg-config/settings.php

    4. Drop the database created during the 'vendor/bin/elgg-cli install' step. 

    5. Create the database using the same DB name that being dropped in step 4

    * A reason that I have to do step 4 & 5 is that it throws this error - General error: 1364 Field 'site_guid' doesn't have a default value at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:107 when running the https://mysite/upgrade.php

    6. Run 'mysql --max_allowed_packet=100M -u root -p myDBName < DBDumpFromElgg2.sql'

    7. Run 'https://mysite/upgrade.php&#39; to migrate the data. 

    8. Flush caches via the admin page - https://mysite/admin

     

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking