如何重置表的主键? [英] How to reset the primary key of a table?

查看:70
本文介绍了如何重置表的主键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表tbphotos中,我有100条记录.然后,我删除了所有记录,现在我要重新开始数据输入,我看到我的主键不是从1开始,而是从101开始.

In my table tbphotos I had a 100 records. I then deleted all the records and now that I want to restart data entry I see that my primary key doesn't start from 1, but it starts from 101,

有什么办法可以重置主键?

Is there any way to reset the primary key?

我正在使用MySQL管理员帐户.

I am using MySQL administrator account.

推荐答案

alter table foo AUTO_INCREMENT = 1

这篇关于如何重置表的主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆