Issue
I tried to create the following table:
CREATE TABLE `updates` (
`update_id` INT(11) AUTO_INCREMENT ,
`update` VARCHAR(45),
`user_id_fk` VARCHAR(45),
`created` INT(11) ,
`ip` VARCHAR(45),
PRIMARY KEY (`update_id`),
FOREIGN KEY (user_id_fk) REFERENCES users(user_id));
Phpmyadmin shown error as
#1005 - Can't create table 'friends.updates' (errno: 150) (Details...)
When I click on 'Details' I get:
InnoDB Documentation Supports transactions, row-level locking, and foreign keys [ Variables | Buffer Pool | InnoDB Status ]
Please help me to overcome with this error.
Solution
It seems user_id field data type in users table is int while here you are creating relation with varchar(45).
For foreign keys data type should be same, so keep it as was in users table.
Answered By - Zafar Malik
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.