I created one script to display the foreign keys in the particular table.
SELECT i.CONSTRAINT_NAME FROM information_schema.TABLE_CONSTRAINTS i
LEFT JOIN information_schema.KEY_COLUMN_USAGE k ON
i.CONSTRAINT_NAME = k.CONSTRAINT_NAME WHERE i.CONSTRAINT_TYPE = 'FOREIGN KEY'
AND i.TABLE_NAME = 'sample';
When I execute this command in my host, it displays the list of foreign key constraints found in all the databases with table name "sample".
But i need particular database, sample table foreign keys.
just add at the end
EDIT :
Change the left join to
because you could find constraint with same name in different schemas.
what’s a schema and a database in mysql