From: Martijn Tonies Date: April 22 2004 1:38pm Subject: Re: Create table results in (errno: 121) List-Archive: http://lists.mysql.com/mysql/164230 Message-Id: <049601c4286f$0d61ca50$0a02a8c0@martijn> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, > I'm trying to create a table with the following syntax > > CREATE TABLE TNSession > ( > SessionID int(11) NOT NULL auto_increment, > IPAddress varchar(50) default NULL, > Created datetime default NULL, > Expired tinyint(4) default '0', > AccountID int(11) default '0', > PRIMARY KEY (SessionID), > KEY FK_AccountID (AccountID), > CONSTRAINT `0_20` FOREIGN KEY (`AccountID`) REFERENCES `TNAccount` > (`AccountID`) > ) TYPE=InnoDB ROW_FORMAT=DYNAMIC; > > it results in a > > ERROR 1005: Can't create table './TNMailServer/TNSession.frm' (errno: 121) > > This is on version mysql-standard-4.0.18-pc-linux-i686 > > Can anyone shed any light on this as it has me stumped - There is a > TNAccount table with a AccountID column? Is it indexed? And don't forget you can use the command SHOW INNODB STATUS\G to show the last FK related error. With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Server. Upscene Productions http://www.upscene.com