1

What I've noticed lately is that whenever I install MariaDB or MySQL on a clean machine, and if I run mysql_upgrade it does the upgrading, so I figured since it's not showing it's already upgraded, I should do it. So, it's been my practice ever since. Does anyone know anything more about this? Why this isn't done during installation process? Does this mean newer mariadb/MySQL server comes with table from older version?

  • 1
    a clean MySQL/MariaDB install should not need mysql_upgrade to be run during initial setup unless you restored a backup from an old version and that backup includes mysql system tables. – jerichorivera Nov 19 '18 at 1:13
  • Understandable, but the question is why does it do any work then? Why doesn't it say "already upgraded" like it does when you run it after upgrade for the second time? I asked an MySQL expert and he answered me so I'll post an answer – Luka Nov 19 '18 at 20:03
  • mysql_upgrade also saves the MySQL version number in a file named mysql_upgrade_info in the data directory. This is used to quickly check whether all tables have been checked for this release so that table-checking can be skipped. this file is not present during initial installation hence when you run mysql_upgrade it will not tell you that there is no need for it on a fresh install – jerichorivera Nov 19 '18 at 22:56
1

According to Bogdan Kecman who worked at Oracle:

mysql_upgrade checks whether the tables are at the latest version, if not - upgrades them and then marks them as upgraded. On a fresh install, even though tables are on the latest version, they are not marked. So, mysql_upgrade marks them. It does nothing else. To avoid scanning them again when mysql_upgrade runs.

Sorry for lousy translation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.