报错:
[HY000][3750] Unable to create or change a table without a primary key, when the system variable ‘sql_require_primary_key’ is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.
出现场景:想要使用以下语句更改数据库的主键文章来源:https://www.toymoban.com/news/detail-806541.html
alter table A
drop primary key;
alter table A
add primary key (id);
解决办法:把两条语句写成一条即可文章来源地址https://www.toymoban.com/news/detail-806541.html
alter table A
drop primary key,
add primary key (id);
到了这里,关于【MySQL】更改表的主键报错及解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!