Description:
Test 1:
$ mysql_upgrade
...
Running 'mysqlcheck'...
All databases will be checked
Because mysql_upgarde is calling mysqlcheck --all-databases
Test 2:
$ mysql_upgrade --all-databases
...
Running 'mysqlcheck'...
All databases will be checked
Because mysql_upgarde is calling mysqlcheck --all-databases
Test 3 (here is the bug):
$ mysql_upgrade mysql
...
Running 'mysqlcheck'...
All databases will be checked
This is fatal. This will cost too much time. Consider, customer production is hit here.
When you want to do the upgrade step by step means database by database you don't want to wait days because mysqlcheck always checks all databases.
It is clear that the system databases like mysql or information_schema always need to be checked too but not the other user databases.
Also when I only want to check the database mysql then mysqlcheck only should check the database mysql and maybe other system databases but not my user database.
How to repeat:
Repeat method 1:
Use mysql 5.0:
create two or three databases.
stop server, remove 5.0, install 5.1:
start server 5.1 and run:
$ mysql_upgrade mysql
****
Repeat method 2:
This is the easier method:
look into the source code from mysql_upgrade and mysqlcheck.
You will see that they don't communicate with each other. That mysqlcheck is ignoring single database input.
Suggested fix:
Repair mysqlcheck and mysql_upgrade so that mysqlcheck only will check the databases that you give with mysql_upgrade if necessary additionally the system databases.