I want to use an sql query, to alter all my database tables engine from MyISAM to InnoDB.
I used the query below. Although it gives me a success message, it doesn t work. Still my table s Storage Engine is MyISAM.
SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=InnoDB;') as ExecuteTheseSQLCommands
FROM information_schema.tables WHERE table_schema = 'name_of_the_database'
ORDER BY table_name DESC;
If you have knowledge in PHP then this script will help you:
If you have knowledge in Shell script then this link will help you:
http://shrubbery.homeip.net/c/display/W/Shell+and+MySQL#ShellandMySQL-ConvertMyISAMtablestoInnoDB (domain name changed by wiki owner)
My solution - launch your mysql shell and paste:
SELECT CONCAT('ALTER TABLE ',CONCAT(TABLE_SCHEMA,'.',TABLE_NAME),'
ENGINE=InnoDB;')
FROM INFORMATION_SCHEMA.TABLES
WHERE ENGINE='MyISAM'
AND TABLE_SCHEMA NOT IN ('MYSQL','INFORMATION_SCHEMA','PERFORMANCE_SCHEMA','SYS')
INTO OUTFILE '/tmp/mysql.conversions';
SOURCE /tmp/mysql.conversions;
See http://dev.mysql.com/doc/refman/5.0/en/converting-tables-to-innodb.html
ALTER TABLE t1 ENGINE=InnoDB;
edit : oh wait, you generated this kind of statements, but they did not work?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.