【问题标题】:Cannot Import Wordpress Website to MySQL Database无法将 Wordpress 网站导入 MySQL 数据库
【发布时间】:2021-04-24 23:04:10
【问题描述】:

这是我的错误: `SQL查询:

--
-- Database: `nicolebrem1`
--

-- --------------------------------------------------------

--
-- Table structure for table `wp_amd_zlrecipe_recipes`
--

CREATE TABLE IF NOT EXISTS `wp_amd_zlrecipe_recipes` (
  `recipe_id` bigint(20) unsigned NOT NULL auto_increment,
  `post_id` bigint(20) unsigned NOT NULL,
  `recipe_title` text,
  `recipe_image` text,
  `summary` text,
  `rating` text,
  `prep_time` text,
  `cook_time` text,
  `total_time` text,
  `yield` text,
  `serving_size` varchar(50) default NULL,
  `calories` varchar(50) default NULL,
  `fat` varchar(50) default NULL,
  `ingredients` text,
  `instructions` text,
  `notes` text,
  `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
MySQL said: Documentation

#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key`

【问题讨论】:

    标签: mysql sql wordpress web


    【解决方案1】:

    您必须将自动增量列设置为主键,如错误消息所述:

    CREATE TABLE IF NOT EXISTS `wp_amd_zlrecipe_recipes` (
      `recipe_id` bigint(20) unsigned PRIMARY KEY NOT NULL auto_increment,
      `post_id` bigint(20) unsigned NOT NULL,
      `recipe_title` text,
      `recipe_image` text,
      `summary` text,
      `rating` text,
      `prep_time` text,
      `cook_time` text,
      `total_time` text,
      `yield` text,
      `serving_size` varchar(50) default NULL,
      `calories` varchar(50) default NULL,
      `fat` varchar(50) default NULL,
      `ingredients` text,
      `instructions` text,
      `notes` text,
      `created_at` timestamp NOT NULL default CURRENT_TIMESTAMP
    ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
    

    【讨论】:

    • 感谢您的帮助,但我遇到了一个新错误。 SQL查询:转储表wp_amd_zlrecipe_recipesINSERT INTOwp_amd_zlrecipe_recipes(recipe_id,post_id,recipe_title,recipe_image,summary,rating,@9876543325@,@9876543325@,@9876543325@,@9876543325@ @,yieldserving_sizecaloriesfatingredientsinstructionsnotescreated_at) VALUES (1, 21, 'Super nutty.. 代码继续 #1062 - 键“PRIMARY”的重复条目“1”
    • @waitwhat 它对我有用,check fiddle。您收到的错误信息是什么?
    • #1062 - 键 'PRIMARY' 的重复条目 '1' .. 我有这样的代码行 INSERT INTO wp_amd_zlrecipe_recipes (recipe_id, post_id, recipe_title, @987654346 @,summary,rating,prep_time,cook_time,total_time,yield,serving_size,calories,fat,instructions,instructions,ingredients,@987654357 created_at) VALUES (1, 21, 'Supe......代码继续
    • 您正在尝试向主键 (recipe_id) 中插入重复值,PK 应该是唯一的
    • 不是我。我刚刚从数据库中导出了这个。我该如何解决?
    猜你喜欢
    • 1970-01-01
    • 2017-08-07
    • 1970-01-01
    • 1970-01-01
    • 2017-11-13
    • 1970-01-01
    • 1970-01-01
    • 2017-11-29
    • 1970-01-01
    相关资源
    最近更新 更多