Bug #80995 mysql_upgrade returns status code 2 if it determines it has already been run

Submitted: 7 Apr 2016 11:00 Modified: 7 Apr 2016 11:06
Reporter: Lars Tangvald Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.7.11 OS:Any
Assigned to: CPU Architecture:Any

[7 Apr 2016 11:00] Lars Tangvald
Description:
When running mysql_upgrade it will store a flag in datadir showing it's been run on that database. If run again it'll simply report that it has already been run. However this second run will return status code 2 instead of 0, which can cause scripts to interpret it as an error and fail.

2 is set as the value for ALREADY_UPGRADED, so this might be deliberate, but it's not documented.

How to repeat:
* Install MySQL server
* Run mysql_upgrade (possibly as root if user does not have write access to datadir)
* Run mysql_upgrade again
* Run echo $? to see the return value

Suggested fix:
Return 0 for ALREADY_UPGRADED, since it shouldn't be an error
[7 Apr 2016 11:06] MySQL Verification Team
Hello Lars,

Thank you for the report.

Thanks,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.