`mysql_upgrade` is failing with no real reason given

I think that it needs username and password

mysql_upgrade -u root -p

If I don't pass them I get your error

Edit: thanks to the comments now I know that there are other reasons, maybe less frequent but it's best to be aware of them too

So you get that error when

  • you didn't pass username and password
  • you passed your credentials, but they were wrong
  • the MySQL server isn't running
  • the permissions' tables are ruined (then you must restart MySQL with mysqld --skip-grant-table)
  • the table mysql.plugin is missing (you'll see an error about that when starting MySQL which suggests to run... mysql_upgrade, and that fails. You probably have some obsolete configuration in my.cnf)

I just encountered these precise symptoms when upgrading from 5.5 to 5.6, and it turned out to be a service reachability issue.

Even though the cli MySQL client could connect to my local DB instance with only a -u and -p provided, I also needed to specify -h 127.0.0.1 for mysql_upgrade as it was attempting a socket file connection and failing miserably in the attempt.