I have just installed a new suse 11.3 machine with mysql as bundled with the suse distro (Server version: 5.1.46 SUSE MySQL RPM) and I wanted to migrate there the databases I had on my old suse 9.2 machine using mysql 4.0.21.
The mysql server on the new system is up and running, with grant tables set OK.
In order to move in the old tables I thought to use the following procedure (which I used in the past moving stuff among other machines):
1 create database xxxx
2 stop the mysql server
3 copy the old files into directory xxxx
4 start the mysql server
5 verify tables are OK
6 recreate the grants for the appropriate users
I tested the procedure on a simple db with just 4 tables, and I fail in step 5. Two tables out of four give errors like this
select * from sax_cumul limit 4;
ERROR 1034 (HY000): Incorrect key file for table 'sax_cumul'; try to repair it
I tried myisamchk *-q -1 -r -safe recover), or REPAIR TABLE and they all fail.
I tried also this command which gives the following messages:
mysqlcheck -p`keyroot` --database logs --check_upgrade --auto_repair
logs.lss_cumul
Error : Incorrect key file for table 'lss_cumul'; try to repair it
error : Corrupt
logs.lss_daily
error : Table upgrade required. Please do "REPAIR TABLE `lss_daily`" or dump/reload to fix it
logs.sax_cumul
Error : Incorrect key file for table 'sax_cumul'; try to repair it
error : Corrupt
logs.sax_daily
error : Table upgrade required. Please do "REPAIR TABLE `sax_daily`" or dump/reload to fix it
Repairing tables
logs.lss_cumul
Error : Incorrect key file for table 'lss_cumul'; try to repair it
error : Corrupt
logs.lss_daily OK
logs.sax_cumul
Error : Incorrect key file for table 'sax_cumul'; try to repair it
error : Corrupt
I am also confused about the need to use character sets and collation sequences. Since all the 4.0 tables were plain ascii stuff at step 1 I used :
create database logs default character set ascii default collate ascii_bin;
Now ascii and ascii_bin get written in file logs/db.opt (which did not exist in mysql 4.0),but if I try a show create table I get (for one of the tables which are legible) lots of references to UTF8 and not to plain ASCII
| sax_daily | CREATE TABLE `sax_daily` (
`occur` int(11) NOT NULL DEFAULT '0',
`dirname` varchar(85) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`filname` varchar(85) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`host` varchar(43) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`subdomain` varchar(85) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`tld` varchar(22) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`errcode` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
(is this part of the problem ?
For the tables which are in error a show create table does not even work e.g.
mysql> show create table sax_cumul;
ERROR 1034 (HY000): Incorrect key file for table 'sax_cumul'; try to repair it
The mysql server on the new system is up and running, with grant tables set OK.
In order to move in the old tables I thought to use the following procedure (which I used in the past moving stuff among other machines):
1 create database xxxx
2 stop the mysql server
3 copy the old files into directory xxxx
4 start the mysql server
5 verify tables are OK
6 recreate the grants for the appropriate users
I tested the procedure on a simple db with just 4 tables, and I fail in step 5. Two tables out of four give errors like this
select * from sax_cumul limit 4;
ERROR 1034 (HY000): Incorrect key file for table 'sax_cumul'; try to repair it
I tried myisamchk *-q -1 -r -safe recover), or REPAIR TABLE and they all fail.
I tried also this command which gives the following messages:
mysqlcheck -p`keyroot` --database logs --check_upgrade --auto_repair
logs.lss_cumul
Error : Incorrect key file for table 'lss_cumul'; try to repair it
error : Corrupt
logs.lss_daily
error : Table upgrade required. Please do "REPAIR TABLE `lss_daily`" or dump/reload to fix it
logs.sax_cumul
Error : Incorrect key file for table 'sax_cumul'; try to repair it
error : Corrupt
logs.sax_daily
error : Table upgrade required. Please do "REPAIR TABLE `sax_daily`" or dump/reload to fix it
Repairing tables
logs.lss_cumul
Error : Incorrect key file for table 'lss_cumul'; try to repair it
error : Corrupt
logs.lss_daily OK
logs.sax_cumul
Error : Incorrect key file for table 'sax_cumul'; try to repair it
error : Corrupt
I am also confused about the need to use character sets and collation sequences. Since all the 4.0 tables were plain ascii stuff at step 1 I used :
create database logs default character set ascii default collate ascii_bin;
Now ascii and ascii_bin get written in file logs/db.opt (which did not exist in mysql 4.0),but if I try a show create table I get (for one of the tables which are legible) lots of references to UTF8 and not to plain ASCII
| sax_daily | CREATE TABLE `sax_daily` (
`occur` int(11) NOT NULL DEFAULT '0',
`dirname` varchar(85) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`filname` varchar(85) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`host` varchar(43) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`subdomain` varchar(85) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`tld` varchar(22) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`errcode` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
(is this part of the problem ?
For the tables which are in error a show create table does not even work e.g.
mysql> show create table sax_cumul;
ERROR 1034 (HY000): Incorrect key file for table 'sax_cumul'; try to repair it