You can extract indices from INFORMATION_SCHEMA database, then add them on another database, but it's not quite easy.
To give you an example (code from a stored procedure used for deployment), this adds an unique key if it's not already there:
if not exists (select * from information_schema.KEY_COLUMN_USAGE
where table_schema = 'database_name'
and table_name='your_table'
and constraint_name ='key_name')
then
alter table your_table add unique key `key_name` ('column_name');
end if;
You can basically find whatever you need in INFORMATION_SCHEMA. I believe you can write code to dynamically check for all these indices, but I'm not sure if it's easy for you.
UPDATE:
You can also use show index from database.table
, as you can see at the link provided by MaasSql's answer. Then loop throuth the results and add each index if it's not in the database.
Or you can try this:
if not exists (select * from information_schema.STATISTICS
where table_schema = 'database_name'
and table_name='table_name'
and index_name ='key_name')
then
...
end if;