This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

Help me understand mariadb-upgrade

Hello,

I use in a docker environment the original MariaDb image version 10.5.25-MariaDB-ubu2004 (FROM mariadb:10.5).

On my development machine I am running RHEL clone Alma along with 10.5.22-MariaDB from shipped with Alma.

When I restore the production database from the docker system to my dev machine I get warned my database needs "mariadb-upgrade.

Two Questions strike my mind:

  • I thought mariadb-upgrade is only necessary on major upgrades. In this regard I assumed version 10.5.22 and version 10.5.25 use the same format
  • In this case there is no upgrade at all 10.5.22 is a lower version then 10.5.25

Please shed some light on me.

Output of "systemctl status mariadb.service"

 
● mariadb.service - MariaDB 10.5 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; preset: disabled)
     Active: active (running) since Mon 2024-08-05 10:41:59 CEST; 25s ago 
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 16205 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
    Process: 16227 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
    Process: 16277 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
   Main PID: 16262 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 14 (limit: 99748)
     Memory: 105.0M
        CPU: 133ms
     CGroup: /system.slice/mariadb.service
             └─16262 /usr/libexec/mariadbd --basedir=/usr

Aug 05 10:41:59 pc144033 systemd[1]: Starting MariaDB 10.5 database server...
Aug 05 10:41:59 pc144033 mariadb-prepare-db-dir[16227]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Aug 05 10:41:59 pc144033 mariadb-prepare-db-dir[16227]: If this is not the case, make sure the /var/lib/mysql is empty before running mariadb-prepare-db-dir.
Aug 05 10:41:59 pc144033 mariadb-check-upgrade[16299]: The datadir located at /var/lib/mysql needs to be upgraded using 'mariadb-upgrade' tool. This can be d>
Aug 05 10:41:59 pc144033 mariadb-check-upgrade[16299]:   1. Back-up your data before with 'mariadb-upgrade'
Aug 05 10:41:59 pc144033 mariadb-check-upgrade[16299]:   2. Start the database daemon using 'systemctl start mariadb.service'
Aug 05 10:41:59 pc144033 mariadb-check-upgrade[16299]:   3. Run 'mariadb-upgrade' with a database user that has sufficient privileges
Aug 05 10:41:59 pc144033 mariadb-check-upgrade[16299]: Read more about 'mariadb-upgrade' usage at: 
Aug 05 10:41:59 pc144033 mariadb-check-upgrade[16299]: https://mariadb.com/kb/en/mysql_upgrade/
Aug 05 10:41:59 pc144033 systemd[1]: Started MariaDB 10.5 database server.

Answer Answered by Bernhard Donaubauer in this comment.

Thank you for your help.

In fact this file is missing. I made a test and deleted the whole "datadir" and started MariaDB. The database was initialized from scratch and "mysql_upgrade_info" is present.

Something is wrong with the backup/restore procedure!

I made my backup and restore with mariadb-backup according to this manual https://mariadb.com/kb/en/incremental-backup-and-restore-with-mariabackup/.

In the "restore" section there is clearly stated "ensure that the datadir is empty" so I deleted the content of /var/lib/mysql and of course the "mysql_upgrade_info" was deleted too.

Obviously "mariadb-backup" did not create this file so either the manual is wrong or some program involved in the restore/startup process should create this "mysql_upgrade_info" file.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.