You came to right place. Let's look at an example.
Suppose you have the following MyISAM table:
CREATE TABLE mydb.mytable
(
id int not null auto_increment,
firstname varchar(20),
lastname varchar(20),
straddr varchar(40),
city varchar(40),
state char(2),
primary key (id)
) ENGINE=MyISAM;
You said you want to do two things:
- Change the table to InnoDB
- Add an index
For the above table, here is how to convert the table to InnoDB and add an index on names
ALTER TABLE mydb.mytable ENGINE=InnoDB;
ALTER TABLE mydb.mytable ADD INDEX name (lastname,firstname);
Here is a way to make the table InnoDB, index it, and keep the original as MyISAM
CREATE TABLE mydb.mytablenew LIKE mydb.mytable;
ALTER TABLE mydb.mytablenew ENGINE=InnoDB;
ALTER TABLE mydb.mytablenew ADD INDEX name (lastname,firstname);
INSERT INTO mydb.mytablenew SELECT * FROM mydb.mytable;
ALTER TABLE mydb.mytable RENAME mydb.mytableold;
ALTER TABLE mydb.mytablenew RENAME mydb.mytable;
CAVEAT
This answer is really an oversimplification of the conversion. There are still other aspects of setting up InnoDB (Here is a Pictorial Representation of InnoDB's Infrastructure). Here are a few of my past posts on such configuration due diligence: