Hi guys I'm searching for a methode (sql code) with which I can convert in my WordpressDB all InnoDBs to MyISAM .
大家好我正在寻找一种方法(sql代码),我可以在我的WordpressDB中将所有InnoDB转换为MyISAM。
My code since now is:
我的代码从现在开始是:
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME,' ENGINE=MyISAM;') FROM Information_schema.TABLES WHERE ENGINE = 'InnoDB'
This gives me back:
这让我回答:
ALTER TABLE db.wp_comments ENGINE=MyISAM;
ALTER TABLE db.wp_links ENGINE=MyISAM;
ALTER TABLE db.wp_options ENGINE=MyISAM;
ALTER TABLE db.wp_postmeta ENGINE=MyISAM;
ALTER TABLE db.wp_posts ENGINE=MyISAM;
ALTER TABLE db.wp_term_relationships ENGINE=MyISAM;
ALTER TABLE db.wp_term_taxonomy ENGINE=MyISAM;
ALTER TABLE db.wp_termmeta ENGINE=MyISAM;
ALTER TABLE db.wp_terms ENGINE=MyISAM;
ALTER TABLE db.wp_usermeta ENGINE=MyISAM;
ALTER TABLE db.wp_users ENGINE=MyISAM;
Now I want to execute all of this rows at once I want to save all the results in one variable and execute them. But a sql variable can just save one row... How do I execute now all of this rows at once with just plain sql code?
现在我想一次执行所有这些行我想将所有结果保存在一个变量中并执行它们。但是一个sql变量只能保存一行......如何使用简单的sql代码立即执行所有这些行?
Thanks in advance
提前致谢
P.S.: can I use "Update" to solve this problem as update may can update the engine to MyISAM?
P.S。:我可以使用“更新”来解决这个问题,因为更新可能会将引擎更新为MyISAM吗?
2 个解决方案
#1
1
Just tested another (simple ?) way, and worked for me.
刚刚测试了另一种(简单?)方式,并为我工作。
Just export your DB as .sql file, edit-it with gedit or notepad;
只需将您的数据库导出为.sql文件,使用gedit或notepad编辑它;
Replace 'ENGINE=INNODB' with 'ENGINE=MyISAM' and Save the file edited
将“ENGINE = INNODB”替换为“ENGINE = MyISAM”并保存已编辑的文件
Number or replacement done should be the number of your tables
完成的数字或替换应该是您的表的数量
Import it to MySQL (phpMyAdmin or command line)
将其导入MySQL(phpMyAdmin或命令行)
And Voila !
还有瞧!
#2
0
Why? MyISAM is going away in the next release of MySQL. MyISAM is less efficient, less robust, etc, etc.
为什么? MyISAM将在MySQL的下一个版本中消失。 MyISAM效率低,不太稳健等等。
Here's how to do the ALTERs
:
以下是ALTER的操作方法:
-
Generate alter statements into a file or the screen. (You have done that.)
在文件或屏幕中生成alter语句。 (你做到了。)
-
Copy them (or feed them) into the mysql commandline tool.
将它们(或它们)复制到mysql命令行工具中。
-
Go get a coffee.
去喝杯咖啡
But watch out for errors.
但请注意错误。
#1
1
Just tested another (simple ?) way, and worked for me.
刚刚测试了另一种(简单?)方式,并为我工作。
Just export your DB as .sql file, edit-it with gedit or notepad;
只需将您的数据库导出为.sql文件,使用gedit或notepad编辑它;
Replace 'ENGINE=INNODB' with 'ENGINE=MyISAM' and Save the file edited
将“ENGINE = INNODB”替换为“ENGINE = MyISAM”并保存已编辑的文件
Number or replacement done should be the number of your tables
完成的数字或替换应该是您的表的数量
Import it to MySQL (phpMyAdmin or command line)
将其导入MySQL(phpMyAdmin或命令行)
And Voila !
还有瞧!
#2
0
Why? MyISAM is going away in the next release of MySQL. MyISAM is less efficient, less robust, etc, etc.
为什么? MyISAM将在MySQL的下一个版本中消失。 MyISAM效率低,不太稳健等等。
Here's how to do the ALTERs
:
以下是ALTER的操作方法:
-
Generate alter statements into a file or the screen. (You have done that.)
在文件或屏幕中生成alter语句。 (你做到了。)
-
Copy them (or feed them) into the mysql commandline tool.
将它们(或它们)复制到mysql命令行工具中。
-
Go get a coffee.
去喝杯咖啡
But watch out for errors.
但请注意错误。