开发者

How to change table storage engine from MyISAM to InnoDB

I executed the command show table status and found that all my tables开发者_开发知识库 had the engine type as MyISAM. I want to change the engine type to InnoDB.

I searched and found the respective query and wrote it as :-

alter table PROJECT_TITLES_ORGANIZATION ENGINE=INNODB; 

but this did not work, I got this error message:

You have an error in your SQL syntax near 'ENGINE=INNODB' at line 1.

I 'm using MySql version is 3.23.54a-11.

Please tell me why is this happening and how to make it work?


I don't think you can do that in your version. From old MySQL docs for CREATE TABLE . . .

The ENGINE and TYPE options specify the storage engine for the table. ENGINE was added in MySQL 4.0.18 (for 4.0) and 4.1.2 (for 4.1).


Your MySQL release is extremely old so you must pay close attention to the exact version when you seek for information. The keyword to set the store engine in v3 was TYPE rather than ENGINE:

ALTER TABLE PROJECT_TITLES_ORGANIZATION TYPE=InnoDB;

The ENGINE and TYPE options specify the storage engine for the table. ENGINE was added in MySQL 4.0.18 (for 4.0) and 4.1.2 (for 4.1). It is the preferred option name as of those versions, and TYPE has become deprecated. TYPE is supported throughout the 4.x series, but likely will be removed in the future.

http://dev.mysql.com/doc/refman/4.1/en/create-table.html


Update: I don't have 3.23 to test stuff. You should make sure that your server has InnoDB enabled. I guess the simplest way is to create a test table as InnoDB and see if you really get an InnoDB table.

If everything else fails and InnoDB is enabled, you can always dump the table into a text file, edit the SQL code to change the engine and reload the dump. Use your server's mysqldump utility and it should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜