Christian Hammers wrote: >Hello > >On 2006-02-21 Joe Emenaker wrote: > > >>When I tried to move to MySQL 5 a few weeks ago, I ran into a little >>snafu with this. The system will let you remove MySQL 4 and install >>MySQL 5 *without* checking to see if you have legacy ISAM tables. When >> >> >This, btw has been fixed in the meantime once I got aware of it :) >Now a big fat warning will be displayed and the preinst script aborted >if a .ISM file is found in /var/lib/mysql. > > If it's possible to determine if an upgrade to 5 is happening *before* version 4 is removed, you can also include a script like the following that the admin can choose to execute: > #!/usr/bin/perl > # > > use strict; > > my $MYSQLDIR = "/var/lib/mysql"; > > my $currentdb = ""; > > open PIPE,"find $MYSQLDIR -name \"*.ISM\" | " || die "Can't read from > $MYSQLDIR\n"; > while(<PIPE>) { > s/\r|\n//g; # Remove trailing CR's & LF's > if(m!^$MYSQLDIR/([^/]+)/([^/]+)$!) { > my($db,$table)=($1,$2); > unless($db eq $currentdb) { > print "use $db;\n"; > $currentdb = $db; > } > print "ALTER TABLE $table ENGINE = MyISAM;\n"; > } > s!^$MYSQLDIR/!!; > } > close PIPE; This script finds all of the ISM tables and outputs a string of "ALTER TABLE..." commands to convert them to MyISAM format. You could pipe that directly into the mysql client app to do the conversion, but you have to do it with version 4, before the upgrade to 5 happens. You might want to put something like this in the version 4 postinst... so that people who are keeping current with 4 would get a message like: "It looks like some of your MySQL tables in an old, outdated format. If you try to upgrade MySQL to version 5 before you convert these tables to the newer format, the MySQL server will refuse to run. Would you like to update your tables now?" Or, you might be able to have MySQL 5 pre-depend upon some intermediate package that checks/upgrades the tables before MySQL 4 is removed. Dunno. - Joe
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature