phpmyadmin - MySQL Error 1215: Cannot add foreign key constraint When forward enigeering -


i'm tring forward engineering model mysql database in phpmyadmin. following error log. why that? should do?

executing sql script in server
error: error 1215: cannot add foreign key constraint

sql code:

        -- -----------------------------------------------------         -- table `emp_log_multi`.`department`         -- -----------------------------------------------------         create table if not exists `emp_log_multi`.`department` (           `iddepartment` int not null auto_increment,           `username` varchar(45) not null,           `fname` varchar(45) null,           `lname` varchar(45) null,           `departmentcol` varchar(45) null,           primary key (`iddepartment`, `username`),           index `df_idx` (`username` asc),           constraint `df`             foreign key (`username`)             references `emp_log_multi`.`login` (`username`)             on delete no action             on update no action)         engine = innodb  sql script execution finished: statements: 6 succeeded, 1 failed 

fetching view definitions in final form.
nothing fetch


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -