12
返回列表 发新帖
楼主: mysqldbd

[原创] 批量修改MyISAM存储引擎为Innodb存储引擎!

[复制链接]
论坛徽章:
6
ITPUB季度 技术新星
日期:2011-08-31 15:27:58ITPUB十周年纪念徽章
日期:2011-11-01 16:26:292012新春纪念徽章
日期:2012-01-04 11:57:36咸鸭蛋
日期:2012-03-05 13:10:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:16:00优秀写手
日期:2013-12-18 09:29:09
11#
发表于 2011-3-26 08:50 | 只看该作者
没动态sql的话,那就变通一下:
show tables;
将所有表拷贝到excel或者其它文本编辑工具中,然后
在其前面加上'alter  table',后面加上' set engine=innodb'
两分钟。

使用道具 举报

回复
论坛徽章:
4
2011新春纪念徽章
日期:2011-04-15 12:20:32咸鸭蛋
日期:2011-08-05 11:40:05ITPUB十周年纪念徽章
日期:2011-11-01 16:26:292012新春纪念徽章
日期:2012-01-04 11:57:56
12#
 楼主| 发表于 2011-3-28 09:37 | 只看该作者
原帖由 Kevin__Zhang 于 2011-3-26 08:50 发表
没动态sql的话,那就变通一下:
show tables;
将所有表拷贝到excel或者其它文本编辑工具中,然后
在其前面加上'alter  table',后面加上' set engine=innodb'
两分钟。


这个方案我可以考虑使用的,只是想得到更方便快捷的,目前还是没有找到啊!

使用道具 举报

回复
论坛徽章:
1
ITPUB十周年纪念徽章
日期:2011-11-01 16:26:29
13#
发表于 2011-3-28 16:39 | 只看该作者
快捷的有啊
在linux下面使用VIM编辑器
mysql 执行show status > 导入外部文件。
VIM编辑,才开头增加alter 在结尾增加语句就可以了。
shell执行报错很明显呢。。
动态SQL话说好危险的,曾经就少创建了几张表。

使用道具 举报

回复
论坛徽章:
4
2011新春纪念徽章
日期:2011-04-15 12:20:32咸鸭蛋
日期:2011-08-05 11:40:05ITPUB十周年纪念徽章
日期:2011-11-01 16:26:292012新春纪念徽章
日期:2012-01-04 11:57:56
14#
 楼主| 发表于 2011-3-28 17:44 | 只看该作者
原帖由 tangchaoql 于 2011-3-28 16:39 发表
快捷的有啊
在linux下面使用VIM编辑器
mysql 执行show status > 导入外部文件。
VIM编辑,才开头增加alter 在结尾增加语句就可以了。
shell执行报错很明显呢。。
动态SQL话说好危险的,曾经就少创建了几张表。


方便说的仔细点吗?

使用道具 举报

回复
论坛徽章:
4
生肖徽章2007版:鼠
日期:2008-01-02 17:35:53生肖徽章2007版:狗
日期:2008-11-26 16:18:37生肖徽章2007版:虎
日期:2009-02-13 16:23:47生肖徽章2007版:马
日期:2009-03-10 21:15:36
15#
发表于 2012-5-16 09:37 | 只看该作者
mysql 5以后自带了个叫mysql_convert_table_format的perl脚本工具,可批量转换。
  1. [root@enpccacti01 mysql]# mysql_convert_table_format
  2. /usr/bin/mysql_convert_table_format  version 1.1

  3. Conversion of a MySQL tables to other storage engines

  4. Usage: /usr/bin/mysql_convert_table_format database [table[ table ...]]
  5. If no tables has been specifed, all tables in the database will be converted.
  6. You can also use wildcards, ie "my%"

  7. The following options are available:

  8. -f, --force
  9.   Continue even if there is some error.

  10. -?, --help
  11.   Shows this help

  12. -e, --engine=ENGINE
  13.   Converts tables to the given storage engine (Default: INNODB)

  14. -h, --host=HOST
  15.   Host name where the database server is located. (Default: localhost)

  16. -p, --password=PASSWORD
  17.   Password for the current user.

  18. -P, --port=PORT
  19.   TCP/IP port to connect to if host is not "localhost".

  20. -S, --socket=SOCKET
  21.   Socket to connect with.

  22. -u, --user=USER
  23.   User name to log into the SQL server.

  24. -v, --verbose
  25.   This is a test specific option that is only used when debugging a test.
  26.   Print more information about what is going on.

  27. -V, --version
  28.   Shows the version of this program.
复制代码

使用道具 举报

回复
论坛徽章:
1
鲜花蛋
日期:2012-05-15 14:24:43
16#
发表于 2012-5-17 20:30 | 只看该作者
如果没有多少数据,能不能先dump出来结构出来,统一修改engine=innodb,然后导入数据呢?

使用道具 举报

回复
论坛徽章:
5
2011新春纪念徽章
日期:2011-02-18 11:43:32ITPUB十周年纪念徽章
日期:2011-11-01 16:26:292012新春纪念徽章
日期:2012-01-04 11:57:362012新春纪念徽章
日期:2012-02-07 09:59:35秀才
日期:2016-06-23 14:15:06
17#
发表于 2012-5-22 10:29 | 只看该作者
shell脚本.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表