What is mysql_upgrade?
If your server runs MySQL databases, then the mysql_upgrade command is one you’ll want to familiarize yourself with. Available only in Unix, mysql_upgrade is a command that checks all tables in all databases for incompatibilities with your current version of the MySQL Server.
After checking your databases, if a table is found to have possible incompatibilities, it is investigated in detail. If any problems are found, the table is repaired automatically.
Once all tables have been checked and repaired, they are marked with the current MySQL version number. This ensures that the next time you run the mysql_upgrade command with the same version of the server, it can determine whether there is any need to check or repair these tables again.
Another feature of mysql_upgrade is that it saves the MySQL version number into a file named mysql_upgrade.info. Contained within the data directory, this file is used to quickly review if all tables are current for this release, allowing future table-checking to be skipped.
Lastly, mysql_upgrade also upgrades the system tables. This allows users to take advantage of new privileges or capabilities that might have been added in new versions of MySQL.
For these reasons, mysql_upgrade should be executed each time you upgrade the MySQL Server to ensure that your tables remain up-to-date and compatible.
How to Use mysq_upgrade
To use mysql_upgrade, you’ll first need to make sure that your server is up and running. Then, from within the terminal, enter the following command:
The way mysql_upgrade works, is by automatically executing the following commands:
mysqlcheck --check-upgrade --all-databases --auto-repair
Looking for more information on MySQL? Search our Knowledge Base!
- View the Contents of a Table in a SQL Server Database Using Enterprise Manager
- Create a MySQL Backup from Command Line – MySQL Import SQL File
- How to Install SQL Server 2012 Express on Windows Server 2012
Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.
The Hivelocity Difference
With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.