Bug #61923 | ERROR 1005 (HY000): Can't create table '.\sanjay\company_users.frm' (errno: 150) | ||
---|---|---|---|
Submitted: | 20 Jul 2011 5:02 | Modified: | 21 Jul 2011 4:15 |
Reporter: | Sanjay Naika | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Errors | Severity: | S3 (Non-critical) |
Version: | mysql--5.0.41-win32 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | ERROR 1005 (HY000): Can't create table |
[20 Jul 2011 5:02]
Sanjay Naika
[20 Jul 2011 5:24]
MySQL Verification Team
shouldn't the second create table be like this? create table company_users (u_id int(10) NOT NULL,user_name varchar(255) NOT NULL,phone varchar(25) NOT NULL,status int(1),company_id int(1),PRIMARY KEY (u_id),Foreign Key (company_id) references company(c_id));
[20 Jul 2011 5:48]
Sanjay Naika
There is no econd create table company_users.
[20 Jul 2011 5:48]
Sanjay Naika
There is no second create table company_users.
[20 Jul 2011 5:59]
MySQL Verification Team
this works for me: create table company (c_id int(10) NOT NULL,company_name varchar(255) NOT NULL,PRIMARY KEY (c_id)); create table company_users (u_id int(10) NOT NULL,user_name varchar(255) NOT NULL,phone varchar(25) NOT NULL,status int(1),company_id int(1),PRIMARY KEY (u_id),Foreign Key (company_id) references company(c_id));
[20 Jul 2011 6:11]
Sanjay Naika
I am using mysql-essential-5.0.41-win32.exe set file. Port : 3307 and replicate same issue on different window machine. Thanks.
[20 Jul 2011 6:16]
MySQL Verification Team
As I said, you have a typo in the second CREATE TABLE. After I fixed it, works nicely: You can SHOW ENGINE INNODB STATUS and look at the foreign key error in there if you want... mysql> select version(); +----------------------+ | version() | +----------------------+ | 5.0.42-enterprise-nt | +----------------------+ 1 row in set (0.01 sec) mysql> create table company (c_id int(10) NOT NULL,company_name varchar(255) NOT NULL,PRIMARY -> KEY (c_id)); Query OK, 0 rows affected (0.02 sec) mysql> mysql> create table company_users (u_id int(10) NOT NULL,user_name varchar(255) NOT NULL,phone -> varchar(25) NOT NULL,status int(1),company_id int(1),PRIMARY KEY (u_id),Foreign Key -> (company_id) references company(c_id)); Query OK, 0 rows affected (0.00 sec)
[20 Jul 2011 6:45]
Sanjay Naika
Thanks for reply: But mysql application has been closed when I am try to fill root password. than I uninstalled mysql and I try to re-install mysql and at the last execute step window says : 'Cannot create window service for Mysql. Error: 0' Please refer attached snapshot. Port : 3307 Thanks.
[20 Jul 2011 6:46]
Sanjay Naika
Snapshot
Attachment: error 0.JPG (image/jpeg, text), 127.91 KiB.
[20 Jul 2011 9:55]
Valeriy Kravchuk
If you have some non-resolvable problems during installation or upgrade, open new bug report (but note that we fix only those bugs that are repeatable with current versions). This is NOT a bug, as Shane proved, just a small misprint in second CREATE TABLE statement.
[20 Jul 2011 10:01]
Sanjay Naika
Thanks but, I would like to known this misprint in second CREATE TABLE statement. because I could not able to create table with foreign key. Thanks
[20 Jul 2011 10:14]
MySQL Verification Team
You wrote: Foreign Key (company_id) references company_users(c_id)); I think you meant: Foreign Key (company_id) references company(c_id)); There is not c_id column in company_users table...
[20 Jul 2011 11:00]
Sanjay Naika
OK But I can create same tables in ubuntu. Please see the attached Snapshot-3.
[20 Jul 2011 11:00]
Sanjay Naika
Snapshot-3
Attachment: Snapshot-3.png (image/png, text), 70.38 KiB.
[20 Jul 2011 11:44]
MySQL Verification Team
you need to add "ENGINE=innodb" to the end of each create table to let mysql know to create innodb instead of myisam tables.
[21 Jul 2011 4:15]
Sanjay Naika
Thanks to reply But I have solved this issue with following steps: 1. Removed mysql folder from C Drive > Program file 2. Delete mysql entry from regedit with searching 'mysqld-nt' value.