Solution:1
SHOW INDEX FROM <tablename>
You want the row where Key_name = PRIMARY
http://dev.mysql.com/doc/refman/5.0/en/show-index.html
You’ll probably want to cache the results — it takes a while to run SHOW statements on all the tables you might need to work with.