How can I determine, do I need to run 'mysql_upgrade` command on database?

Percona-server-5.6.41 is installed and running now for a several monthes. Before it mysql-5.6 was installed. In-place upgrade was done (removed mysql and installed percona). But I don't know, was mysql_upgrade executed or not.

There're no errors about table mismatches in logs.

DB is large enough, 900+ tables and about 150Gb of size.

1 Answer 1


mysql_upgrade will generate a file informing if it was run on the datadir. If it was run for the specific version you have, the mysql_upgrade_info file would contain the current version string and will prevent a new run of mysql_upgrade unless --force is used. Cat $datadir/mysql_upgrade_info file to know which version was ran on last.

Even if for some reason that file was missing, running mysql_upgrade is relatively safe- so much that most packages and init systems run it automatically on upgrade/start. I don't like to do it automatically, because I like to have control over when it is run- For example, it can take a very long time with many files, and it can create metadata locks due to the nature of the DDL commands it executes, but 99% of the installations can run it safely, assuming no other traffic is ongoing.

DB is large enough, 900+ tables and about 150Gb of size

My 2TB database with 100K tables and 100K views takes around 30 minutes to run, to give you an idea (SSDs). My other 2TB servers with a few dozen tables just takes <10 seconds.

My recommendation is to just run it, unless you have long running queries on it. It can be killed in general in the worst case scenario. The problems when it is not run are worse (although it is true those normally only happen on major version upgrades or during the first minor versions within a major version).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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