Error 150 Sql
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss sql error 1005 the workings and policies of this site About Us Learn more
Mysql Error 150
about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow sql error 121 Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping
Sql Error No 150
each other. Join them; it only takes a minute: Sign up MySQL: Can't create table (errno: 150) up vote 121 down vote favorite 18 I am trying to import a .sql file and its failing on creating tables. Here's the query that fails: CREATE TABLE `data` ( `id` int(10) unsigned NOT NULL, `name` varchar(100) NOT NULL, `value` varchar(15) sql error number 150 NOT NULL, UNIQUE KEY `id` (`id`,`name`), CONSTRAINT `data_ibfk_1` FOREIGN KEY (`id`) REFERENCES `keywords` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; I exported the .sql from the the same database, I dropped all the tables and now im trying to import it, why is it failing? MySQL: Can't create table './dbname/data.frm' (errno: 150) sql mysql phpmyadmin mysql-error-1005 share|improve this question edited Oct 31 '10 at 0:37 OMG Ponies 198k36356415 asked Oct 31 '10 at 0:24 gtilx 75421018 1 For essentially all the causes of this error, here is an exhaustive resource for what causes errno 150 (and errno 121/other foreign key errors) in MySQL. –John Smith Sep 29 '12 at 0:47 15 I've found that the columns must be identical (even the unsigned flag must match). –Justin Skiles Dec 19 '12 at 19:54 3 @JohnSmith ... where? –Charles Wood Jul 29 '13 at 17:07 3 I suggest reading this blog post that lists 10 possible causes: verysimple.com/2006/10/22/… –Mark Amery Jan 2 '14 at 13:54 1
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this
Errno 150 Sql
site About Us Learn more about Stack Overflow the company Business Learn more
Mysql Create Table Error 150
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss errno 150 mysql foreign key Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySql Error 150 http://stackoverflow.com/questions/4061293/mysql-cant-create-table-errno-150 - Foreign keys up vote 13 down vote favorite 2 When I execute the follow two queries (I have stripped them down to absolutely necessary): mysql> CREATE TABLE foo(id INT PRIMARY KEY); Query OK, 0 rows affected (0.01 sec) mysql> CREATE TABLE bar ( id INT, ref INT, FOREIGN KEY (ref) REFERENCES foo(id)) ENGINE InnoDB; I get the following error: ERROR 1005 (HY000): Can't http://stackoverflow.com/questions/825362/mysql-error-150-foreign-keys create table './test/bar.frm' (errno: 150) Where the **** is my error? I haven't found him while staring at this for half an hour. mysql mysql-error-1005 share|improve this question edited Apr 30 '11 at 17:18 OMG Ponies 198k36356415 asked May 5 '09 at 15:14 Martin Thurau 4,72342561 add a comment| 7 Answers 7 active oldest votes up vote 24 down vote accepted From FOREIGN KEY Constraints If you re-create a table that was dropped, it must have a definition that conforms to the foreign key constraints referencing it. It must have the right column names and types, and it must have indexes on the referenced keys, as stated earlier. If these are not satisfied, MySQL returns error number 1005 and refers to error 150 in the error message. My suspicion is that it's because you didn't create foo as InnoDB, as everything else looks OK. Edit: from the same page - Both tables must be InnoDB tables and they must not be TEMPORARY tables. share|improve this answer answered May 5 '09 at 15:22 Greg 198k35305302 A bit of quick testing, creating a foo as above with MyISAM, and a bar with
Community Podcasts MySQL.com Downloads Documentation Section Menu: MySQL Forums :: InnoDB :: ERROR 1005: Can't create table (errno: 150) New Topic Advanced Search ERROR 1005: Can't create table (errno: 150) Posted by: elmpie () Date: March 24, 2005 01:20PM I'm using the MySql version that comes with the Debian Sarge. (mysql Ver 12.22 Distrib 4.0.23, for pc-linux-gnu (i386)) I already have one database that has a few tables with foreign keys. I've created a anew database and it seems impossible to put new foreign keys on these tables? So I've tried the most basic thing ans its still not working. create table test1 (pk_alias int not null auto_increment, primary key (pk_alias)) type=innodb; create table test2 (pk_alias2 int unsigned not null auto_increment, fk_test1 int not null, primary key (pk_alias2), foreign key (fk_test1) references test1(pk_alias)) type=innodb; I don't really get it. What am I doing wrong?? Thanks! Navigate:Previous Message•Next Message Options:Reply•Quote Subject Views Written By Posted ERROR 1005: Can't create table (errno: 150) 641054 elmpie 03/24/2005 01:20PM Re: ERROR 1005: Can't create table (errno: 150) 304077 Martin Lukasiewycz 03/28/2005 02:15PM Re: ERROR 1005: Can't create table (errno: 150) 215418 KimSeong Loh 03/29/2005 08:42PM Re: ERROR 1005: Can't create table (errno: 150) 155609 Michael Buell 05/30/2005 10:29AM Re: ERROR 1005: Can't create table (errno: 150) 149724 Chris Yuan 10/27/2005 11:01PM Re: ERROR 1005: Can't create table (errno: 150) 92335 Deepak Kumar 03/14/2008 11:45PM ERROR 1005: Can't create table (errno: 150) 72374 Pradeep Max 07/07/2008 09:00AM Re: ERROR 1005: Can't create table (errno: 150) 49759 karthik sakthi 03/12/2009 07:38AM Re: ERROR 1005: Can't create table (errno: 150) Global solution 50899 Mayur P Vegad 06/23/2010 08:13AM Re: ERROR 1005: Can't create table (errno: 150) Global solution 20525 B S 08/13/2011 09:04PM unfortunately not 4825 Gavin Stokes 10/09/2012 09:48PM Re: ERROR 1005: Can't create table (errno: 150) 37428 Agyeya Gupta 04/26/2009 06:23AM Re: ERROR 1005: Can't create table (errno: 150) 25611 Chris Walker 06/28/2009 1