zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

MySQL 跟已存在的字段添加自增长属性

mysql属性 添加 存在 增长
2023-09-11 14:22:27 时间

原文:
https://www.runoob.com/mysql/mysql-alter.html
https://www.cnblogs.com/chimpan/p/9625719.html



跟表 blade_menu 增加自增长属性

ALTER TABLE blade_menu CHANGE id id BIGINT auto_increment not null;

跟所有表增加自增长属性

-- ALTER TABLE blade_client CHANGE id id BIGINT auto_increment not null;
select
 CONCAT('ALTER TABLE ',table_name,' CHANGE id id BIGINT auto_increment not null;')
from information_schema.tables
where 1=1 
	and table_schema='blade'
	and table_type='base table';