Check MySQL / MariaDB table for Primary Key

It is pretty straightforward to check a MySQL / MariaDB table for a Primary Key, connect to the db server, login or open up your favorite MySQL client.

Without selecting any table, issue the following command:


Where <TABLE> is the name of the table you want to check.

The result returned should have a line show up with the Primary Key.

Note: If the result is empty, that means the table does not have a Primary Key.

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.