修复 WordPress 数据库错误查询 INSERT INTO 的键“PRIMARY”重复条目“0”

问题描述 投票:0回答:2

在 Wordpress 4.9.5 上,当我启用简单错误日志插件时,我在管理面板上收到此错误。

这是我们得到的错误:

WordPress 数据库错误 密钥“PRIMARY”的重复条目“0” 查询 INSERT INTO

wp_posts
(
post_author
,
post_date
,
post_date_gmt
post_content
post_content_filtered
post_title
post_excerpt
post_status
post_type
comment_status
ping_status
post_password
post_name
to_ping
pinged
post_modified
post_modified_gmt
post_parent
menu_order
post_mime_type
guid
)值(14、 '2018-04-17 18:24:27', '0000-00-00 00:00:00', '', '', '自动草稿', '', '自动草稿', '发布', '打开', '打开', '', '', '', '', '2018-04-17 18:24:27', '0000-00-00 00:00:00', 0, 0, '', '') 由 wp_dashboard 制作, do_meta_boxes、call_user_func、wp_dashboard_quick_press、 get_default_post_to_edit,wp_insert_post

我尝试从 PHPMYADMIN 修复此表,也尝试过此https://blog.sqlauthority.com/2016/09/12/mysql-fix-error-wordpress-database-error-duplicate-entry-key-primary- query-insert-wp_options/https://wordpress.stackexchange.com/questions/165277/new-posts-defaulting-to-0-primary-key 但它无法解决。

请告知可能出现什么问题以及如何解决该问题。

php mysql wordpress
2个回答
0
投票

我也遇到了同样的问题,并且以下错误消息显示在我的网站之一的顶部:

WordPress 数据库错误:[键“PRIMARY”的重复条目“0”] 插入

Umr_actionscheduler_actions
(
hook
status
scheduled_date_gmt
scheduled_date_local
schedule
group_id
args
) 值 ('wpforms_email_summaries_fetch_info_blocks', 'pending', '2023-07-02 18:51:31', '2023-07-02 18:51:31', 'O:32:"ActionScheduler_IntervalSchedule":5:{s:22:" * Scheduled_timestamp";i:1688323891;s:18:" *first_timestamp";i:1688323891;s:13:"* 复发";i:604800;s:49:"ActionScheduler_IntervalSchedule start_timestamp";i:1688323891;s:53:"ActionScheduler_IntervalScheduleinterval_in_seconds";i:604800;}', '2', '{"tasks_meta_id":null}') 跳至主要内容

这篇文章帮助我解决了这个问题 - https://www.newzealandgoonline.co.nz/how-to-fix-wordpress-database-error-duplicate-entry-0-for-key-primary-for-query -插入-wp_usermeta/

简而言之 - 将自动增量设置为表的主键。

根据错误消息我在phpMyAdmin中打开了表“Umr_actionscheduler_actions”。之后单击“结构”,然后单击主键旁边的“更改” - 在我的例子中为“action_id”

按下 AI 下的复选标记,然后单击保存。成功了!


0
投票

...也许您必须在更改列设置之前更改现有条目的 id。如果是这样,您将收到一条警报“将导致重复输入”。照顾一个ID = 0,将其更改为最高ID值+1。

© www.soinside.com 2019 - 2024. All rights reserved.