执行如下命令,查看是否有无主键表。
select table_schema,table_name from information_schema.tables
where (table_schema,table_name) not in(
select distinct table_schema,table_name from information_schema.columns where COLUMN_KEY='PRI'
)
and table_schema not in (
'sys','mysql','information_schema','performance_schema'
);
执行如下命令,查看参数implicit_primary_key的值是否为ON。
show global variables like 'implicit_primary_key';
执行如下命令,修改无主键表。
alter table <表名> engine=innodb;
执行如下SQL语句,为无主键表添加主键。
ALTER TABLE <表名> ADD PRIMARY KEY (<需要设为主键的列名>);
400-100-2938
添加客服小罗微信
添加客服小罗QQ
售后微信服务号
售后企业QQ
Copyright © Yisu Cloud Ltd. All Rights Reserved. 2018 版权所有
广州亿速云计算有限公司 粤ICP备17096448号-1
粤公网安备 44010402001142号 增值电信业务经营许可证编号:B1-20181529