gpt4 book ai didi

mysql - 重置自动递增列(替代方法)

转载 作者:行者123 更新时间:2023-11-29 02:20:03 25 4
gpt4 key购买 nike

大家晚上好。这是我的案例:

首先,我正在通过 phpMyAdmin 使用 MySQL(顺便说一句,我才刚刚开始学习)。我的表中有 4 列,其中 2 列是自动递增的列: meta_idpost_id 。两者都是 BIGINT,因此每次通过 Wordpress 中的媒体库添加图像时,它们的数量都会增加。我截断了所有数据,使用 ALTER TABLE tablename AUTO_INCREMENT = 1 并开始添加新媒体。但在那之后我意识到重置只对 PRIMARY 列有影响,就像这样:

+---------+---------+-----------+------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+-----------+------------+
| 1 | 97402 | something | something |
| 2 | 97403 | sth | sth |
| 3 | 97404 | sth | sth |
...

那么我怎样才能同时重置 PRIMARY 而不仅仅是重置 ojit_code 呢?

提前致谢,伙计们:)

最佳答案

在 phpmyadmin 上:
open table goto menubar operation 然后选择 empty the data table(truncate)

关于mysql - 重置自动递增列(替代方法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33425579/

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