Philipp's Computing Blog

Success is about speed and efficiency

[solved] mysql_upgrade failes due to "1045: Access denied"

Error when trying to upgrade the mysql tables using mysql_upgrade:

root@fooserver:/root# mysql_upgrade 
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' 
mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed

The solution is to run mysql with the option --skip-grant-tables and then do the upgrade:

/etc/init.d/mysql stop
/usr/bin/mysqld_safe --skip-grant-tables&

mysql_upgrade

/etc/init.d/mysql stop 
/etc/init.d/mysql start

resources