gpt4 book ai didi

MySQL:键 'PRIMARY' 的重复条目

转载 作者:行者123 更新时间:2023-11-29 12:08:38 25 4
gpt4 key购买 nike

我有下表:

+------+--------+---------+------------+----------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+------+--------+---------+------------+----------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+
| logs | MyISAM | 10 | Dynamic | 34823016 | 237 | 8285517176 | 281474976710655 | 357365760 | 192 | 34823017 | 2015-06-17 21:37:54 | 2015-06-26 15:49:21 | NULL | utf8_general_ci | NULL | | |
+------+--------+---------+------------+----------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+

mysql> show columns from logs;
+--------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+------------------+------+-----+---------+----------------+
| ID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| ReceivedAt | datetime | YES | | NULL | |
| DeviceReportedTime | datetime | YES | | NULL | |
| Facility | smallint(6) | YES | | NULL | |
| Priority | smallint(6) | YES | | NULL | |
| FromHost | varchar(60) | YES | | NULL | |
| Message | text | YES | | NULL | |
| InfoUnitID | int(11) | YES | | NULL | |
| SysLogTag | varchar(60) | YES | | NULL | |
| CustomerID | bigint(20) | YES | | NULL | |
| NTSeverity | int(11) | YES | | NULL | |
| Importance | int(11) | YES | | NULL | |
| EventSource | varchar(60) | YES | | NULL | |
| EventUser | varchar(60) | YES | | NULL | |
| EventCategory | int(11) | YES | | NULL | |
| EventID | int(11) | YES | | NULL | |
| EventBinaryData | text | YES | | NULL | |
| MaxAvailable | int(11) | YES | | NULL | |
| CurrUsage | int(11) | YES | | NULL | |
| MinUsage | int(11) | YES | | NULL | |
| MaxUsage | int(11) | YES | | NULL | |
| EventLogType | varchar(60) | YES | | NULL | |
| GenericFileName | varchar(60) | YES | | NULL | |
| SystemID | int(11) | YES | | NULL | |
| processid | varchar(60) | NO | | | |
| checksum | int(11) unsigned | NO | | 0 | |
+--------------------+------------------+------+-----+---------+----------------+

我正在尝试插入一行:

INSERT INTO logs (ID, ReceivedAt, DeviceReportedTime, Facility,
Priority, FromHost, Message, InfoUnitID, SysLogTag, CustomerID,
NTSeverity, Importance, EventSource, EventUser, EventCategory,
EventID, EventBinaryData, MaxAvailable, CurrUsage, MinUsage,
MaxUsage, EventLogType, GenericFileName, SystemID)
VALUES ('34823017',
'2015-06-26T15:06:02+03:00',
'2015-06-26T15:06:38+03:00',
'22',
'6',
'po-sv-bus-01v',
'type=SYSCALL msg=audit(1435320388.132:831638): arch=c000003e syscall=4 success=yes exit=0 a0=7f4bc8616ca0 a1=7f4bd1c10c00 a2=7f4bd1c10c00 a3=0 items=1 ppid=1 pid=3489 auid=286786658 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=204 tty=(none) comm="rsyslogd" exe="/sbin/rsyslogd" subj=unconfined_u:system_r:syslogd_t:s0 key="power-abuse"',
'1',
'audit: ',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'');

我收到错误:

ERROR 1062 (23000): Duplicate entry '34823017' for key 'PRIMARY'

虽然没有重复条目:

mysql> select * from logs where ID = '34823017';

Empty set (0.00 sec)

有人可以帮助我吗?

最佳答案

不要手动设置 ID。例如,您可以传递 null,然后它会自动递增

关于MySQL:键 'PRIMARY' 的重复条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31074224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com