当前位置:网站首页>How to start ID from 1 after MySQL deletes a table
How to start ID from 1 after MySQL deletes a table
2022-06-27 23:13:00 【bksheng】
Method 1 :
# Delete
delete from Table name ;
# Set to from 1 Start to grow
ALTER TABLE Table name AUTO_INCREMENT=1;
Method 2 :
# Delete the foreign key constraint before deleting
SET foreign_key_checks = 0;
# Delete all data , Reposition self incrementing fields
truncate table Table name ;
# After deletion, execute the start foreign key constraint
SET foreign_key_checks = 1;
边栏推荐
- PHP connects to database to realize user registration and login function
- Is it safe for GF futures to open an account?
- Spark BUG實踐(包含的BUG:ClassCastException;ConnectException;NoClassDefFoundError;RuntimeExceptio等。。。。)
- Spatial relation query and graph based query in secondary development of ArcGIS Engine
- Stunned! The original drawing function of markdown is so powerful!
- Mysql database experiment report (I)
- Advertising is too "wild", Yoshino "surrenders"
- 【蓝桥杯集训100题】scratch数字计算 蓝桥杯scratch比赛专项预测编程题 集训模拟练习题第16题
- C # QR code generation and recognition, removing white edges and any color
- [cloud based co creation] what is informatization? What is digitalization? What are the connections and differences between the two?
猜你喜欢
Workflow automation low code is the key
Vue+mysql login registration case
Is the dog virtue training with a monthly salary of 30000 a good business?
【IDEA】IDEA 格式化 代码技巧 idea 格式化 会加 <p> 标签
This year's examinees are more "desperate" than the college entrance examination
初识C语言 第二弹
打造南沙“强芯”,南沙首届IC Nansha大会召开
【经典干货书】数据科学中的信息理论方法,561页pdf
Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing
The most illusory richest man in China is even more illusory
随机推荐
ABAP essay - material master data interface enhancement - tab enhancement
PHP connects to database to realize user registration and login function
Avoid using 100vh[easy to understand] at mobile terminal
基于 ESXi 的黑群晖 DSM 7.0.1 安装 VMware Tools
Basic knowledge of loop traversal and function
Oracle obtains the beginning and end of the month time, and obtains the beginning and end of the previous month time
Crawler notes (2) - parse
Brief introduction to game phone platform
Basic data type and complex data type
Spug - 轻量级自动化运维平台
Design of STM32 and rc522 simple bus card system
批量处理-Excel导入模板1.1-支持多Sheet页
【经典干货书】数据科学中的信息理论方法,561页pdf
“顶流爱豆制造机”携手四个产业资本,做LP
跨系统数据一致性问题解决方案汇总
跟着存档教程动手学RNAseq分析(三):使用DESeq2进行计数标准化
医美大刀,砍向00后
MapReduce初级编程实践
pytorch 入门指南
How to use RPA to achieve automatic customer acquisition?