`mysql_upgrade` is failing with no real reason given
Solution 1:
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)
Solution 2:
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.
Solution 3:
That seems a Plesk server, when using Plesk there is no root for Mysql, but the administrator of Mysql called admin, so this command should work on Plesk as I tried it before:
mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`
Solution 4:
you could try running these one by one to see where it fails:
mysql_upgrade executes the following commands to check and repair tables and to upgrade the system tables:
mysqlcheck --all-databases --check-upgrade --auto-repair
mysql < fix_priv_tables
mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table-names
from http://dev.mysql.com/doc/refman/5.5/en/mysql-upgrade.html
Solution 5:
Same issue! The solution for me came from http://www.freebsd.org/cgi/query-pr.cgi?pr=180624
Briefly: the error is misleading! run mysql_upgrade -u root -p
with the DB on-line and provide the root password.