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

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

Posted on Wednesday, December 1, 2010 by Matti

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 mysqlupgrade, but in order to run that command, MySQL needs to be functioning. And it won’t do that, until mysqlupgrade 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 -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 “iblogfile0″ or “iblogfile1″? If so; rename them, and try restarting MyS

viaMySQL: “Table ‘mysql.plugin’ doesn’t exist” after MySQL Upgrade ~ Mattias Geniar.