Tuesday, November 3, 2009

MySQL upgrade for FC10 to FC11

I, and many other people apparently, ran into a MySQL bug while upgrading from FC10 to FC11. The error messages included "Fatal error: Can't open and lock privilege tables: Incorrect key file for table 'host'; try to repair it". It looks like there were MySQL v4 tables, and not running an upgrade for 5.0 created a problem for 5.1. Googling found one answer to be downgrading to 5.0, upgrading the tables, upgrading to 5.1 and doing another upgrade. Why either MySQL or FC couldn't do the right thing is beyond me. Anyway, removing the 5.1 libs breaks a lot of other programs, so I took the approach of building and installing 5.0 in /usr/local, doing the upgrade using that set of binaries, then going back to using the 5.1 binaries in /usr. This did the trick. I might have been able to use "rpm --prefix-", but didn't try. Here is the approximate incantation.
cd /usr/local/src
wget mysql-5.0.87.tar.gz
# from http://dev.mysql.com/downloads/mysql/5.0.html#source
gunzip mysql-5.0.87.tar.gz
tar xf mysql-5.0.87.tar
cd mysql-5.0.87
./configure --prefix=/usr/local
make install
export PATH=/usr/local/bin:$PATH
mysql_upgrade --socket=/var/lib/mysql/mysql.sock
/usr/local/bin/mysqladmin shutdown

export PATH=$P
mysql_upgrade --socket=/var/lib/mysql/mysql.sock

No comments: