L
L
londhor2018-02-26 16:20:07
SQL
londhor, 2018-02-26 16:20:07

Why "#1215 - Unable to add foreign key constraints" in SQL?

I'm trying to import a table after moving to another host, but I get an error: #1215 - Unable to add foreign key constraints

CREATE TABLE `result_info` (
  `id` int(11) NOT NULL,
  `wk2_id` int(11) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  `inc_all` decimal(16,2) NOT NULL DEFAULT '0.00',
  `exp_all` decimal(16,2) NOT NULL DEFAULT '0.00',
  `profit` decimal(16,2) NOT NULL,
  `comment` varchar(1000) COLLATE utf8_bin NOT NULL,
  `user_id` int(11) NOT NULL,
  `created_at` datetime NOT NULL,
  `changed_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AVKor, 2018-02-26
@AVKor

Here .

K
kkt, 2018-02-26
@kkt

perhaps there is no primary key?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question