-- 查看表的所有索引
show index from 't_name'

-- 判断某个索引是否存在,如果不存在则创建。
DROP PROCEDURE IF EXISTS schema_change; 
DELIMITER //
CREATE PROCEDURE schema_change() BEGIN
DECLARE  CurrentDatabase VARCHAR(100);
SELECT DATABASE() INTO CurrentDatabase;
IF NOT EXISTS (SELECT * FROM information_schema.statistics WHERE table_schema=CurrentDatabase AND table_name = 't_name' AND index_name = 'myindexName') THEN 
   ALTER TABLE `t_name` ADD Index 'myindexName' ( `columnName` )  USING BTREE;
END IF; 
END//  
CALL schema_change();