Withdata Software

How to get primary key of a table from MySQL

select COLUMN_NAME,INDEX_NAME
from INFORMATION_SCHEMA.STATISTICS
where TABLE_SCHEMA = 'my_schema_name'
and TABLE_NAME='my_table_name'
and INDEX_NAME='PRIMARY'

See also:

How to get primary key of a table from PostgreSQL

How to get primary key of a table from SQLite

How to get primary key of a table from SQL Server

How to get primary key of a table from DB2

How to get primary key of a table from Oracle

Some MySQL tools you can try: https://www.withdata.com/mysql/