MySQL: “Table ‘mysql.plugin’ doesn’t exist” after MySQL Upgrade

Oh Dear monitors your entire site, not just the homepage. We crawl and search for broken pages and mixed content, send alerts when your site is down and notify you on expiring SSL certificates.

Start your free 10 day trial! »

Profile image of Mattias Geniar

Mattias Geniar, December 01, 2010

Follow me on Twitter as @mattiasgeniar

After running a MySQL upgrade, you can run into the following problem which prevents you from starting MySQL successfully.

101126 10:29:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101126 10:29:53 [Note] Plugin 'ndbcluster' is disabled.
 /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
101126 10:29:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
101126 10:29:53  InnoDB: Started; log sequence number 1 3337694676
101126 10:29:53 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
101126 10:29:53 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50045, now running 50153. Please use mysql_upgrade to fix this error.
101126 10:29:41  InnoDB: Shutdown completed; log sequence number 1 3337694676

This is a real chicken and egg problem. To fix the problem, we need to run mysql_upgrade, but in order to run that command, MySQL needs to be functioning. And it won’t do that, until mysql_upgrade is run. Humpf.

It’s most commonly caused by an old my.cnf config file, which could be solved like this.

# cp /etc/my.cnf /etc/my.cnf_backup
# cp /etc/my.cnf.rpmnew  /etc/my.cnf
# /etc/init.d/mysqld start

The reason is because in MySQL 5.0, a config variable named “skip-bdb” would exist in the my.cnf, which was removed in MySQL 5.1. Alternatively, you could comment out the “skip-bdb” parameter in the my.cnf, and try restarting MySQL. A bugreport has already been filed.

After which you need to run the mysql_upgrade.

# mysql_upgrade -u <user> -p

Alternatives to check, if the above does not work, is:

  • Are all files in /var/lib/mysql (or whatever your MySQL datadir is), owned by mysql?
  • Are there old logfiles in /var/lib/mysql named “ib_logfile0” or “ib_logfile1”? If so; rename them, and try restarting MySQL.

Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.