客户须要创建无主键表,因提供默认模板设置了参数sql_require_primary_key = ON(创建新表或更改现有表结构的语句强制要求表具有主键),当创建无主键表时会提示ERROR 3750 (HY000): Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. 无法创建,现须要将参数修改为sql_require_primary_key = OFF,但更改文件重启实例后失效。
greatsql> SHOW VARIABLES LIKE 'sql_require_primary_key';
ERROR 3750 (HY000): 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.
复制代码
二、问题排查
利用命令修改先解决问题
因该参数sql_require_primary_key支持动态修改,先利用 SET global sql_require_primary_key = OFF修改,举行表创建。
# Session修改
greatsql> SET sql_require_primary_key = OFF ;
# Global修改(需重新登录session)
greatsql> SET GLOBAL sql_require_primary_key = OFF ;