Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql table creation Error Code: 1005 in this specific case
    primarykey
    data
    text
    <p>I have tried everything in solving this issue and yes I know that this type of question is already asked here but I could not solve my issue It is <code>mysql</code> database</p> <pre><code> Error Code: 1005 Can't create table '.\project\comments.frm' (errno: 150) </code></pre> <p>the foreign keys are matching in structure (i.e <code>length</code> and <code>type</code>) then what can be the possible problem in the table creation</p> <p>Table which is giving error is <code>comments</code>:</p> <pre><code> CREATE TABLE `comments`( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `description` VARCHAR(100) NOT NULL, `user_id` INT(10) UNSIGNED NOT NULL, `post_id` INT(10) UNSIGNED NOT NULL, FOREIGN KEY (`post_id`) REFERENCES `posts`.`id`, FOREIGN KEY (`user_id`) REFERENCES `users`.`id`, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=latin1;` </code></pre> <p>Here is posts table which is already created in the databas</p> <pre><code> CREATE TABLE `posts` ( `id` int(10) unsigned NOT NULL auto_increment, `title` varchar(30) default NULL, `description` longtext, `image` varchar(50) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; </code></pre> <p>Here is the users table which is also already created in the database</p> <pre><code> CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL auto_increment, `user_name` varchar(33) default NULL, `email` varchar(255) NOT NULL, `password` varchar(255) default NULL, `type` varchar(255) NOT NULL, `registrationDate` date NOT NULL, PRIMARY KEY (`id`,`email`,`type`) ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload