Error
Error Code: 1173

MySQL Error 1173: Table Type Needs Primary Key

📦 MySQL
📋

Description

Error 1173 indicates that you are attempting to create or modify a table using a storage engine that explicitly requires a primary key, but one has not been defined. This typically happens with storage engines like NDBCLUSTER (MySQL Cluster) which rely on primary keys for their internal architecture and data management.
💬

Error Message

This table type requires a primary key
🔍

Known Causes

3 known causes
⚠️
Using NDBCLUSTER Storage Engine
The NDBCLUSTER storage engine, commonly used in MySQL Cluster, strictly requires a primary key for all tables to ensure data consistency and distribution across nodes.
⚠️
Omitted Primary Key in SQL
The `CREATE TABLE` or `ALTER TABLE` statement you executed did not explicitly define a `PRIMARY KEY` constraint for the table being created or modified.
⚠️
Converting Table to Strict Engine
You may be attempting to change an existing table's storage engine to one (like NDBCLUSTER) that mandates a primary key, but the table currently lacks one.
🛠️

Solutions

Coming Soon

Detailed step-by-step solutions for this error are being prepared. In the meantime, try these general troubleshooting tips:

General Troubleshooting Tips

  • Check the error message carefully for specific details
  • Review recent changes that might have caused the error
  • Search for the exact error code in the official documentation
  • Check log files for additional context
  • Try restarting the application or service
🔗

Related Errors

5 related errors