我在 Mysql 中创建了一个新表,添加了一些行,但显示表的 Auto_increment 字段仍然返回 NULL。
mysql手册说:这个字段应该返回:“下一个Auto_increment值”
https://dev.mysql.com/doc/refman/8.0/en/show-table-status.html
我究竟做错了什么?
如何正确找到下一个 auto_increment 值?
重现步骤:
create table `test` (
`id` int(5) not null auto_increment,
`name` varchar(256),
PRIMARY KEY(`id`)
);
Run Code Online (Sandbox Code Playgroud)
然后我运行:
show table status where name like 'test';
Run Code Online (Sandbox Code Playgroud)
结果:
Name, Engine, Version, ..., Auto_increment, ...
'test', 'InnoDB', '10', ..., NULL, ...
Run Code Online (Sandbox Code Playgroud)
然后我运行:
insert into test values(null,'name1');
insert into test values(null,'name2');
insert into test values(null,'name3');
Run Code Online (Sandbox Code Playgroud)
编辑:-其他插入语法-
insert into test (name) values('name4');
insert into test (name) values('name5');
insert into test (name) values('name6');
Run Code Online (Sandbox Code Playgroud)
获取表的状态
show table …Run Code Online (Sandbox Code Playgroud) 我有一个PHP软件,用mod_rewrite做漂亮的事情.但是相同的软件应该在没有安装mod_rewrite的服务器上运行.如果安装了mod_rewrite并且是否应用了某个规则,我可以检查我的php代码吗?
例如,像这样:
if ((mod_rewrite is enabled) and (mod_rewrite_rule is OK)){
return createBeautifullLink();
}else{
return createUglyLink();
}
Run Code Online (Sandbox Code Playgroud)
提前致谢